Super short and simple post this time, because it's explaining a simple concept. The concept is so simple, that I'm slightly embarrassed, almost shocked, that it took me almost 7 years of professional programming, and 3 and a half years of college to see and use this pattern.
The tip? Any time you are writing code and the order of the lines is irrelevant, such as declaring class variables, creating a JSON object, populating an associative array, adding dependencies, configuring your configuration, ad infinitum, use alphabetical order.
I was recently reading a blog post by Aaron Saray called In PHP, False is Sometimes True. This is an issue that I've encountered in the past and I'd already considered blogging about the solution, which is something Aaron left out of his blog post.Read More
This is a quick an easy guide to setting up a file watcher on PhpStorm so that every time a php file is saved, php-cs-fixer is ran on the file. More than just a linter, php-cs-fixer will update your code to match coding standards such as the official PSR-1 and PSR-2, as well as community standards such as the Symfony one. It will also do someRead More
Although we've still got a while to go before we see php 7.3, since we're still 4 days away from the release of php 7.2, I've already seen one new feature that looks like it will make its way into 7.3 that I am excited about. This feature is more flexible syntax for heredoc and nowdoc statements. Here is the official rfc if you'd like to read it.
Switching from my hand-made, hodgepodge, cobbled together collection of libraries that was trying to act more and more like a "framework" every day to a full-blown real, properly developed, properly tested framework like Symfony continues to be the best decision I've made in my programming career thus far. I've learned so much about clean code, design patterns, SOLID principles and many other programming best practices from working within Symfony's MVC (Model View Controller) pattern and reading its documentation and code when I need to extend it to bow to my every whim.Read More
When I started my current position way back in the winter of 2013 as the sole Application Developer in a corporate/enterprise environment, I was tasked with maintaining existing web applications, porting Visual Basic apps into a web environment, as well as creating new applications. Each of the php applications that I had inherited had several shared dependencies that were maintained independently in their separate project directories. Any bug that was found and fixed in one of these 'libraries' had to be copied manually to the other projectsRead More
Introduced in version 5.0.2 of php,
PHP_EOL is a string constant that represents the correct end of line symbol for
the platform that you are running php on.
So on Windows this should be set to
"\r\n" (carriage return and line feed) and on a *nix system it should be set to
"\n" (only line feed).
I've been wanting to start blogging for quite some time now, and I figured there is no time like the present.
I am familiar with both WordPress and Drupal, but I wanted to "roll my own" both for flexibility and as a learning experience.
Since this blog is going to be code heavy, one thing that was really important to me was code highlighting in the display.
I really like the code highlighting on the Symfony documentation pages, and I've used that in some of my own documentation pages,
however, that is using Sphinx and
.rst files, which requires a compilation step. I was looking for a way to have markdown files parsed by a real-time HTML converter to give me syntax highlighted code in HTML.
That's how I discovered highlightjs.
Todd Eidson is a full stack application developer and life-long learner. He is a pragmatic programmer, a believer in clean coding, and an evangelist for extensible and reusable code. His hobbies include collecting old jazz records and going to live music performances.
North Central Ohio, US
All opinions are my own, probably wrong, and subject to change without notice.
© 2017 Todd Eidson. All content is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.