A junior programmer with a master's asked me, "Is PHP a dying language being taken over by trending technologies like Ruby on Rails?" Here are my thoughts.
It all comes down to order. Order is what defines us, clarifies ideas. Order allows us to get to market quicker, safer, and less defects. Order is a pristine engine that is maintainable, scalable and extendable.
Back in 2006, when Ruby on Rails was developed from Basecamp by David Heinemeier Hansson, it seemed to be the next, best pioneering language. There were a lot of great things, right out of the solution: version control system, dependency management, Rake (an internal Domain Specific Language for compiling and building), RSpec for testing (another internal DSL), ability to swap in visual external DSL's such as jade, haml, and finally, an inherent MVC pattern based on the framework: Rails, and more.
PHP, starting in 1998, was a rebellious language. Compiler-less, it was created as a tool to assist managing and developing a single resume on a site. The community was large, cacophonous, fragmented and building faster, cooler, crazier (and less secure) sites than any other language, because nothing was holding it back.
That led to more than a few missing tools. No central framework or major contenders. No guidelines. No testing. No version control system. Poor dependency management (PEAR). We broke the sins of DRY with repeating ourselves CakePHP, Codeigniter, Kohana, and more, each trying to outdo the other. But instead of building castles, we were throwing sand, because we weren't thinking modularly. Introduce Composer, a light-weight package management system that allowed us to leverage each other's libraries. To use Composer, we tie packages to their repositories and codebases: hence Git (and Github), and other version control systems.
There's a problem that I've been shouting about for years. The problem of Digital Fragmentation.
- In the 1970s, engineers focused on developing features for Hardware Systems (Apple was born in a garage in 1976, Microsoft in 1975).
- In the 1980s, engineers were working on Operating Systems and Applications (and the previous generation's systems).
- In the 1990s, engineers were working on Websites (and the previous generation's systems).
- In the 2000s, engineers were working on Mobile Applications (and the previous generation's systems).
- In the 2010s, engineers were working on the Internet of Things, including mobile, wearable, micro-controlled, drone, and other diverse applications (and the previous generation's systems).
The growth of engineers, designers, product owners, product managers has not met the diverse, fragmented opportunities out there. Each eco-system is responding by sharing their codebase, leveraging automated solutions, encouraging learning and knowledge-share, creating tests to defensively code, and more. Phil Sturgeon goes into some detail on the reason for the creation of Laravel and Composer. Most importantly, the PHP-FIG: a group dedicated to creating coding standards that are interoperable within the PHP language.
PHP. Coding. Standards. That's an oxy-moron from the rebellious, compiler-less punks in 1998. This, from Rasmus Lerdorf, one of the original developers saying, "I don’t know how to stop it, there was never any intent to write a programming language […] I have absolutely no idea how to write a programming language, I just kept adding the next logical step on the way."
PHP in 2014 is in a Renaissance. PHP developers now have powerful frameworks (Symfony! Laravel!), a well-trod version control system that beginner developers use (Git!), dependency management (Composer!), Testing (PHPUnit! and others), a build system within Laravel at least (Artisan!). The mass of PHP developers are leveraging best practices (Thin Controller-Fat Model), and sharing their patterns.
Moreover, PHP is widely adopted, taking on 82% of the entire web-server space. Most of the top CMS's used are all on PHP. As of January 2013, 244M sites are using PHP. Compare that to the Bureau of Labor Statistics estimation that there are 141,400 web developers in the United States in 2012. On average, that is 1,725 websites per developer.
Oh wait, not all 141,400 are PHP developers! Nope, it's closer to... 55%, which is around 77,770 developers. The new average is 3,137 websites per web developer. What happens when there aren't enough plumbers to manage a city's plumbing?
This is based on a snapshot of secondary statistics, including:
- Github Languages and Trends: http://redmonk.com/dberkholz/2014/05/02/github-language-trends-and-the-fragmenting-landscape/
- LangPop: http://langpop.com/
- Top Github Languages for 2014, so far: http://adambard.com/blog/top-github-languages-for-2013-so-far/
PHP was a Tribe in early 2000s. Now, with the technology available to us by community leaders we have the freedom to operate. We need to act as a community. Just ask Phil Sturgeon:
I don't want any PHP developers wasting their time on tribal bullshit. I don't want people having to spend time relearning over and over again. I don't want developers getting religious about their choice. I don't want people having to port packages to work on other frameworks. All of that is happening, and all of it needs to stop. We are the PHP community and together we are fucking huge. 80% of the internet is ours, and we need to remember to work together instead of fragmenting the community, siloing it with framework specific resources that have no reason to exist.
PHP isn't dead. It's not dying. It has 80% of the web servers and is growing. Innovations are happening:
- HVVM for Just-In-Time compilation and performance boost,
- Hack, an interoperable, type-supporting coding language with PHP that works on HVVM](http://hacklang.org/)
- Growing adoption of PHP 5.5 and PHP 5.6
- Increasing standards in PSR-0, PSR-1, PSR-2, PSR-3, and PSR-4
PHP just needs to live up to its namesake of badass developers doing badass things to make their lives easier. Kids are growing up.