The Future of PHP is Shared Power Tools
by [Not Provided]
When I think about the most historically popular web libraries and tools, I think of things built in PHP--like Drupal, WordPress, phpBB, or Joomla. These are the Great Pyramids of the web: they're impressive not only because of what they can do, but also because these original "wonders of the Internet" were built entirely without modern tools or real collaboration. Each project painstakingly thought about and solved the same problems from scratch. And despite that, the results were incredible. How? Because they leveraged the sheer size and passion of their respective PHP communities.
But it makes me wonder: what crazy things could we build if we worked together?
Fortunately, we're on our way to finding that out. The PHP world is transforming and the individual armies and empires are blurring together. Here to stay are collaboration, sharing, and innovation. And ultimately, the biggest beneficiary will be the everyday developer who's trying to build increasingly complex projects more quickly and cheaply.
The PHP Super Friends
To make this all happen, the superheroes of PHP needed to stop fighting the same problems independently and start working together. This is already happening all over and its impact changes the game in two very important ways.
First, by using existing tools and libraries, superheroes (i.e. projects like Drupal) can focus on what they do best. Drupal 8 decided to use pieces from Symfony, Zend Framework, Doctrine, Guzzle and more for this exact reason. Guzzle, for example, is an HTTP-request and web-service integration library developed in part by the Amazon AWS team. By using it, Drupal gets "free" features and more time to do what it does best. Why spend time writing code to make HTTP requests when you're building a CMS and Guzzle already has your back? Later, if someone finds a subtle, hard-to-fix bug in Guzzle, there's also a good chance someone other than a Drupal developer will spend time to fix it.
Second, projects themselves are being re-made to be more and more modular, which means that smaller and smaller pieces can be used all on their own. Imagine current Drupal as a big machine that builds skyscrapers. Now imagine you already own a cute house and just want to add a new bedroom. That's not so easy. You can either try to hack the Drupal machine or smash a brand new building on top of your cute house (i.e. a rewrite). The process of allowing these projects to be broken into smaller pieces is still in its infancy, but eventually, we'll use new Drupal like we use power tools. Need some content-storage capability? There might be a piece of Drupal for that. Want to leverage its publishing interface? Sure, you could have just that. Need the full-blown CMS? That's of course still there.
I've used Drupal as an example, but this re-use and modularity is happening all over the PHP-landscape:
- PHPBB uses 13 Symfony components and a variety of other open source libraries.
- Laravel is a custom framework built on top of many Symfony components, allowing it to be quickly built and immediately feature-rich and popular.
- eZ Publish is a CMS built on the Symfony framework
- Joomla has already decoupled parts of its core and uses a variety of outside libraries, including Symfony's YAML component.
- Speaking of the Symfony YAML component, it's used by over 15 open source projects, including Magento.
- Flow3, Sylius, Elcodi, OroCRM, Piwik, Sylius, Behat … and many more projects are all using Symfony components. To see where and how all the Symfony components are being used, head over to symfony.com.
A Swiss Army Tool with Rockets for Everyone!
Whether you know or care about all of this community-kumbaya, its impact for real developers creating real applications is huge.
First, the tools you know and love already will be better, easier to use and more reliable as the boring low-level problems are solved with re-usable components (e.g. Symfony). But this goes even further: with all those plumbing problems solved, you will see more and more new tools popping up. For example, have you heard of Sylius or Elcodi as E-Commerce tools? What about OroCRM as a CRM component? What about the Symfony CMF toolset, which aims to solve the very complex but specific problem of content storage?
Second, the modularization of tools is flattening the barriers that used to make multi-faceted applications really tough to build. Before, if you were building a custom app with some CMS and eCommerce needs, you could only choose one tool (e.g. Symfony, Drupal, or Magento) to solve one problem. Then, you just hacked at that tool until your round pegs fit into its square holes.
Today and in the future, you'll get to choose exactly the power tools you need, like using E-Commerce components (e.g. from Sylius or Elcodi) inside a custom framework (e.g. Symfony) that also leverages some Drupal content publishing pieces. That's like building a hotel where the plumbing, scaffolding and elevator system are delivered to you complete - for free - on day one of construction. And when you need a complex menu system (KnpMenu), an abstract file system that's able to store things locally or in S3 (Flysystem), or something that can read and write to a complex content storage engine (Symfony CMF)--just Google the problem, install a library with Composer, and move into those real business problems.
At the end of the day, all of this effort is aimed at making it easier and faster to develop complex, maintainable features. When something like a Symfony component is used in Drupal, one common complaint is that it increases complexity. And in the short-term, I agree! But over the long-term, using higher-quality development practices is not mutually exclusive with being accessible to the developer. To the contrary, with more and more people using the same code, we have a much greater opportunity to find complexities and squash them: this will ultimately improve developer experience. We're actively doing this in the Symfony community with the Developer Experience initiative. Its consequences will be felt by any project using its components.
Building Flux Capacitors and Warp Drives Together
You've heard the phrase "building on the shoulders of giants", and we're living it in the PHP world. These "giants" are some of the most successful web-based projects and the people doing the building form one of the largest developer communities in the world. Each time a small new library solves a tiny problem or a big project makes a piece more modular, tens of thousands of developers gain yet another shared power tool. With this, we will build more impressive projects faster, and at a lower cost. We'll also build even more tools on top of even taller giants.
The history of PHP involved raw (wo)manpower, and it built amazing things. The future of PHP is shared power tools. Watch out!
Guest author dossier
- Name: Ryan Weaver
- Twitter: @weaverryan
- Website: KnpUniversity.com
- Work affiliation: KnpLabs US
- FOSS role: “The Symfony ‘docs’ and developer experience guy”
- Current projects: Symfony documentation, KnpUniversity.com
- When/which PHP you started with: “probably PHP 4.x, way back around 2001”
- Ryan Weaver is the documentation lead for the Symfony Framework, trainer and consultant at KnpLabs US, writer for KnpUniversity.com and an avid supporter of open source as a tool to solve serious business problems. Ryan likes to present topics in a narrative way - building real applications and telling a story as you learn and develop. He's a published author, speaker and, most importantly, the husband of the wonderful Leanna Pelham.
tool_library.jpg Image by takomabibelot https://www.flickr.com/photos/takomabibelot/220265100
License: License: https://creativecommons.org/licenses/by/2.0/