How to Keep Your PHP Skills Sharp for the Next Generation of WordPress
The enormous strides that WordPress has taken as a platform in the past 12 years have been mirrored by developments around the language it’s written in: PHP.
It’s a language that has attracted more than its fair share of criticism, but there have been significant improvements in the language and the wider ecosystem in recent years.
In this article, we’ll cover what you need to know as a developer to keep your PHP skills up to par for WordPress and the wider web beyond.
Let’s start with a quick review of the language itself and then run through the best resources for keeping your skills sharp and up-to-date.
How PHP Conquered The World
PHP has been on the scene now for 20 years and dominates the web development landscape. It’s used by over 80% of websites and was installed on over a quarter of a billion websites as recently as 2013.
It also remains extremely popular in the wider development world, placing fifth in the list of most-used programming languages in Stack Overflow’s 2015 developer survey.
PHP’s relatively easy learning curve and widespread availability have long made it an early favourite of newbie programmers – and its adoption by successive waves of CMS systems such as Drupal, WordPress, and Joomla! have contributed substantially to its overall ubiquity.
The Promise of PHP7
Sitepoint has a useful overview of resources for PHP developers to consult to get up to speed on changes coming down the pipeline, and sites such as Engine Yard are also running an introductory series to the new version.
What the next generation of PHP will mean for WordPress has been a hot topic recently, with a major presentation on the subject being given in June at WordCamp Europe 2015 by Zeev Suraski. Matt Mullenweg also fielded questions regarding backwards compatibility and PHP during a Q&A at the same event.
Given the solid track record of WordPress in supporting older versions of PHP in core, it’s unlikely that the 5x branch will be dropped any time soon, but the new version certainly does look promising.
Facebook has, of course, made its own contribution to the evolution of PHP in the form of its HipHop Virtual Machine, which promises equally significant performance improvements. There are also some interesting comparisons between their offering and PHP7 starting to emerge.
While core language improvements are definitely gathering pace, the majority of recent developments in the world of PHP have been in terms of culture, tooling, and community. It’s those that we’ll largely focus on for the remainder of this article.
WordPress and PHP
As a WordPress developer, your first port of call in terms of staying up to speed on PHP standards should be the WordPress Coding Standards page.
In contrast to strongly opinionated languages such as Go or Python, PHP is famously laissez-faire in terms of how it can be used. The adoption of a set of commonly agreed best practices is a great way of imposing some order on your day-to-day coding.
Source code is, as developer Jeff Atwood notes, “the ultimate truth” and as a PHP developer it should be a given that you stay familiar with both the Code Reference and the guts of the software itself.
Modern PHP Best Practices
Spurred on by competition from languages such as Python and Ruby – particularly in its Rails incarnation – the world of PHP has modernized considerably in the last decade.
A brief list of areas to keep up-to-speed on includes the following:
- Coding standards: As mentioned earlier, WordPress has its own set of PHP standards, but there are also several alternative guidelines out there in the wild. Regardless of the exact rules selected, the average PHP project these days will insist on some sort of standardization in this respect so it’s a good idea to study some examples and get familiar with them.
- Dependency management: Dependency and package management were long-standing bugbears of PHP developers for many years until the recent emergence of Composer as a relatively standard way of handling libraries and dependencies. If you haven’t already gotten up to speed on Composer, check out tutorials from Lynda.com or Tuts+ to sharpen your chops.
- Version control: By 2015, the use of version control should be a given for any kind of software development and the PHP community is these days largely on board. Development of the language itself takes place via Git – and if you’re still on the fence about using version control, there is no better time than today to learn the basics.
- Development environments: Having some sort of local development setup is pretty much a must at this stage, and PHP developers are increasingly leaning on advanced solutions such as Vagrant to standardize their work across all environments.
- Testing: The testing culture in PHP has historically lagged behind other languages such as Java or Ruby, but it is catching up. WordPress itself, for example, relies heavily on automated testing for development. If this is an area that is new to you, take some time to explore PHPUnit and the basics of implementing testing in WordPress projects.
- Deployment: Deployment has come a long way from the days of slinging around files via FTP. PHP developers are increasingly leveraging tools such as Phing, Capistrano and Deployer to automate all aspects of their deployment processes.
Learning from PHP Frameworks
Frameworks, whether in the form of Zend, CodeIgniter or CakePHP had of course always been available in PHP, but a combination of better marketing, genuine technical innovation and the advantages of a green-field start all combined to make the new kids on the block particularly attractive in recent times.
The last number of years have seen PHP getting back in the game with a new generation of frameworks that seek to take the best from projects such as Rails or Django and implement them in PHP.
There is no shortage of modern PHP frameworks out there but if you’re looking for one to get your teeth into in order to sharpen your skills then look no further than Laravel. Excellent documentation and tutorials make it a solid place to start exploring standard best practices in modern PHP development.
Studying a well put together framework is a great way of keeping your PHP skills sharp and staying in the loop across all aspects of modern approaches to running a project.
We’ve touched on a number of specific resources so far, but there are also a number of excellent general resources out there to help you hone your PHP knowledge. A short list includes:
PHP the Right Way: Josh Lockhart’s site is an excellent introduction to general best practices in PHP and all aspects of development and deployment.
Online training: Treehouse and Lynda both offer comprehensive PHP courses. Explore the basics of testing or standard PHP best practices with Treehouse, or dive deeper into PHP frameworks and design patterns with Lynda.
Stack Overflow: Stack Overflow remains a godsend in terms of day-to-day troubleshooting of common PHP issues.
Hacker News: The Y Combinator community site is not exactly famous for being friendly to PHP, but it’s a great way of taking the pulse of the wider development community and staying current with wider trends.
High Scalability: PHP is just one layer of any development environment and it’s in your interests as a developer to have at least a passing familiarity with the rest of the stack. The detailed breakdowns at High Scalability provide fascinating insights into how some of the biggest websites in the world actually work under the hood.
User groups: There is a huge community of PHP developers worldwide split across high-profile projects such as WordPress, Laravel, and many others. Take advantage of this by looking for conferences, local PHP user groups, and meetups in your area, and studying presentations online.
Moving Beyond PHP
As a WordPress developer, you’re in an excellent position to expand your skill set and considerably bump your hourly or daily rate by embracing this change, rather than resisting it.
Consider exploring the following areas to take your game to the next level:
- Tackle Python: If you’re up to speed on PHP as a developer, obtaining a working knowledge of Python should be a straightforward affair. Taking the time to get familiar with another language, community and set of best practices will add to your general value as a developer and help give your PHP work a wider context.
- Explore Swift: A large part of WordPress’ future is going to be focused on integration with mobile devices. Apple’s recent announcement that its new Swift programming language is going to be open sourced makes it an excellent long-term bet as a developer.
A big part of succeeding as a WordPress developer involves actively cultivating a multi-disciplinary skill set. Staying on top of developments in PHP should be a core part of that endeavor.
Here’s a recap of some of the main suggestions we covered for doing just that:
- Keep a close eye on PHP and general coding best practices in WordPress.
- Stay up to date with developments in the wider PHP community via sites such as PHP the Right Way.
- Never stop learning. Use online resources such as Lynda and Treehouse to hone your skills.
- Branch out. Explore the world beyond PHP to provide context and breadth to your progression as a developer.
We’re curious to hear how you manage staying up to speed as a PHP developer. Are there resources we’ve missed here or ones you want to highlight? Get in touch via the comments below and let us know.