PHP and Symfony: Structure, Stability and Flexibility
PHP is probably the most popular backend programming language powering the web. It has been around for twenty years in this year. This is a venerable achievement in the web world where technologies come and go. PHP rose to its current popularity in the early 2000s and continues to be ubiquitous.
As an Open Source technology sharing has always been a natural part of working with PHP. The catch is that it was not that easy to cherry pick certain functional components from the vast libraries of code to use in your own applications.
There have been efforts like PEAR, plenty of frameworks and applications - each with their own code and ideologies. There were some universally popular libraries such as Magpie for RSS feed parsing, but as a whole the community was divided by invisible barriers. This kept people busy solving the same problems time and time again.
Many parties also worked on reusable components that would be easy to cherry pick to products. eZ Systems worked on eZ Components, a PHP component library, which failed to gain traction in a market where there was no standard way of installing these components. You could say they were ahead of their time as they're still availailable and relevant as Zeta Components.
The PHP Framework Interop Group (PHP-FIG), as the name implies, was setup to help bring these communities together in 2009. The improvements to the PHP language itself and the PSR (PHP Standard Recommendation) initiatives helped pave the way to modern PHP. The Composer packet manager (with dependency management, etc.) released in 2012 was the final piece to the PHP ecosystem we have today.
Now we've got a community with a standard mechanism for distributing, installing and using shared code. Many projects now build completely upon shared components while others are slowly taking including tried and tested components into their legacy code.
I like to think of modern PHP frameworks as glue to put together components to form something that is more than the sum of it's parts. But just as you've got different kinds of glue, you've also got different frameworks. For some cases it's enough for a flexible bond to last only months, where as some cases the planned lifetime is a decade or more.
The Symfony Components are a collection of individual stand-alone pieces of code built for a very specific task. Developers can use these and other components where and how they see fit to form an application of their own. This will allow developers to use familiar template syntax, etc. across different projects.
The Symfony Framework is a standard way (and framework code) to create applications using components. The application is always built with a specific structure, which allows code reuse of complete functionalities (Bundles in Symfony lingo) across projects. If you build using a collection of components, you'll need to invest time in learning how that software has decided to use the available components.
A component might allow you to connect to a search engine on a low level. A bundle could contain additional code and functionalities to make it fast to create complete features upon the component - in our example to store data and perform queries on a search engine. Another practical example would be including the eZ Platform Core to your application to display managed content in your custom built application.
In addition to direct higher level code sharing, a shared framework also allows developers to move across application fluently. Your custom projects and Open Source projects such as eZ Platform, OroCRM and Symfony CMF all share the common code structure, conventions, terminology, etc.
In addition to technical structure, the Symfony roadmap and LTS (long term support) releases provide stability for both business and developers. Companies such as the travel portal Trivago, digital media provider Spotify and Fox international use the Symfony Framework on their web properties and API endpoints.
PHP itself has matured to a language that allows developers to create very well structured applications. At the same time it has not lost the flexibility and ease of use which lead to it's popularity. The launch of PHP 7 and continued investment from Facebook on HHVM (an alternative PHP runtime) enable the language (and it’s close cousin Hack) to evolve and stay relevant. You can even get on the HTTP/2 train today with H2O and PHP.
It is worth noting that the web is by nature a volatile environment. PHP and the Symfony Framework are well positioned to serve as a core for your applications. PHP continues to evolve, but it is advisable to consider adopting supporting technologies at the edges of your core functionality where they solve the problem better. Some call this the Hexagonal Architecture.
To enable this there are plenty of high quality integration Symfony Bundles available. You can integrate with MongoDB Document Databases, Neo4j Graph Databases, ElasticSearch for search, Varnish for Delivery and Rabbit MQ for messaging and many others.
In select use cases PHP might not be an ideal platform for public facing properties. It is completely feasible to create a separate delivery layer using other technologies such as Erlang or Node.JS - all while keeping content and data management in your Symfony Framework application. Symfony backend utilities such as translations and routing can be exposed to your front end easily.
The combination of the PHP language at 20 years and the Symfony framework at 10 years offers a stable platform with flexibility to adapt and grow in the future.