I don’t often blog, but when I do… I always try to come up with something truly useful. A bit of code, a tip, or, as in this case, The Right Way to do something.
So what exactly is The Right Way when it comes to PHP? Since PHP is the hammer I’ve used to nail up solutions everyday for the past 5 years, I’ve tried to stay abreast of the language’s features and offerings. Recently I stumbled across Josh Lockhart’s website PHP: The Right Way.
PHP: The Right Way is a veritable treasure trove of concepts, best practices, and recommendations for PHP coders of all experience levels. As Josh so succinctly puts it, “There’s a lot of outdated information on the Web that leads new PHP users astray, propagating bad practices and bad code”. That’s certainly a truism, and one Josh aims to correct with this website.
PHP5 includes features long decried as essential to a ‘good’ language by critics. This holds especially true for v5.3 and v5.4. OOP, anonymous functions (i.e. closures or blocks), dynamically invoked functions, recursion, and many, many other features, have made their way into PHP5. Subsequently PHP5 is not only a viable web language solution, it’s also an elegant one.
As evidence, take a look at Slim.php. Slim is a PHP micro framework designed for writing RESTful APIs. If you’ve ever looked at Ruby’s Sinatra framework, you’ll recognize Slim right away. Micro frameworks like Slim are changing the way a modern web solution is coded using PHP.
Even though I’ve referred to it here as Josh’s site, the fact is it’s very community driven. The source for the site is on github and can be forked by anyone. Josh openly solicits your additions and pull requests.
So let’s help the PHP community and direct new PHP coders to do PHP: The Right Way. Heck, dare I say it, there are a few of us veteran PHP guys that could stand a visit there too.
Stay thirsty my friend… ;)