Technical musings on PHP, specifically Zend Framework (1 and 2)
With the wide adoption of Composer, does this mark a shift change in the projects the OS community will be working on?
It started with a tweet:
Building a PHP app by gluing things together using Composer is turning out to be the right decision #noframework— Chris Hartjes (@grmpyprogrammer) May 3, 2013
And that intrigued me. Does Composer's wide adoption in the PHP community at large mark the start of a shift from full stack frameworks (like Symfony and Zend Framework), towards people contributing to open source "modules" that do one thing, but do it really really well?
Let's say your starting a new project, and you don't want to use a full stack framework (in the current climate you'd be called mad, but bare with me here a minute...). You've got some favourite components that you currently use in other projects.
For dependency management, you want to use Pimple, you'd like your logging handled by Monolog. For your DBAL/ORM you're a big fan of Doctrine, and for your view layer you've always wanted to try Mustache.
Go to it. Add these projects as Composer dependencies, and you only need to create a simple routing system, a rudimentary MVC and away you go, you're concentrating your time on your core business logic in just as little time as using a full stack framework but without the concessions you inevitably make when choosing one. Let's be honest, a rudimentary MVC is only a way of translating the requested URL to a predictable class/method.
For me, this is even more attractive than adopting, say, Zend Framework 2, because _you've_ written your core code, and therefore _you_ understand exactly how and why your routing and MVC work. I'm sure someone will quickly tell me "why not just use x micro-framework? It handles routing and MVC only leaving you to fill in the gaps!", and I'm sure that is a viable alternative, but maybe that defies the point I'm trying to make. Many times in my ZF based career I've found myself deep in the MVC to understand how and why a certain behaviour is happening (or even better, badgering the person who wrote it in IRC).
Of course, using a cocktail of great OS projects from the web will still give you this problem in the individual components you are using. But for me, understanding how it all hangs together is a massive plus in the rapid development and maintenance of a project of average complexity.
Those who know me will know I am a definite evangelist of Zend Framework 2; it's what I use to earn my daily bread. I'm not advocating stopping using ZF2 just yet, but what I am wondering is will the PHP ecosystem be a healthier place if we have groups of kick-ass developers solving one problem really well, rather than trying to spread themselves thinly writing and maintaining a full stack. After all, there are only a finite number of contributors to even the most popular OS project.
In all honesty, people will probably think I'm crazy for asking these questions, but for me, this is a very interesting time to be involved in the community. I don't think Zend of Symfony will be turing off their framework GitHub repos just yet, but it will definitely be interesting to see what the future holds!