The Golden Age of PHP Frameworks
Both PHP and myself as a developer have come a very long way since a year ago. Earlier last year, I began to hear about a new framework making waves: Laravel
But what is Laravel? Why should anyone care? After all, frameworks come and go. Before, we were hearing all about CodeIgniter and CakePHP. And before that, Zend Framework was very popular amongst the PHP core community. What good would it do me to switch everything over to Laravel?
In short: Nothing
There is absolutely NO good reason in taking an existing architecture that works - and works well - and switching it over to the buzzword of the year. If you're doing this, then you've completely missed the point of a framework. In order to better understand the purpose of a framework, one needs to understand what a framework is not:
A framework IS NOT "better"
Often times, you'll hear that one particular framework is "better" than another. Some people will even go so far as to use a framework - or a particular framework - for EVERY project they take on. Quite simply, this is wrong. The effectiveness of a framework is dictated by its implementation, not by the tools it provides. Since my company has its roots in construction, let's use some analogous use-case scenarios:
- It would be extremely ineffective to attempt to build a house with a screwdriver and a shovel: A full-stack framework will come with more powerful tools to create your web application
- Building an outhouse with a backhoe would be a waste of resources: Sometimes a Micro-framework or a Component-framework is enough to handle a smaller project
- You don't need anything but your hands to build a sandcastle: Some projects do not require a framework at all
A framework is designed to handle all of the low-level concerns (Routing, Input Validation, Authentication, etc.) encountered in nearly every web application. Rather than re-invent the wheel every time, frameworks abstract away this kind of functionality into easy-to-use components to allow developers to focus their time and energy on the unique functionality the application needs to provide solutions the customer demands. If your project doesn't require this level of abstraction, or you don't plan on leveraging the common solutions most frameworks provide, then chances are good that you can write everything by hand. There's no shame in getting your hands dirty when you're building a sandcastle.
A framework IS NOT a CMS (Content Management System)
Often times, people are under the assumption that full-stack frameworks will give them everything they need in order to put together a fully-functional website without having to write any code. This is not the case. While it may be true that CMSs are considered frameworks, what separates the two is that Frameworks are code-oriented while CMSs are module-oriented. In simpler terms: A CMS will come with a back-end containing a series of tools (or modules) to help you manage your front-end without having to write your own - or at least very little - code.
A framework IS NOT a language
While frameworks will vary in naming conventions and syntax, this does not mean that they are a language unto themselves. Popular CMSs and frameworks like Wordpress and Symfony are still written in PHP and must therefore work within those constraints. Believe it or not, there are many developers who have a strong background in a particular framework or CMS, but only a rudimentary understanding of the language that drives it. Similarly, some companies will hear about a new CMS or framework and limit new developer job criteria to those platforms. This can actually end up serving as a bottleneck for creative solutions to unique problems that undoubtedly arise during the development process.
With all of that said, PHP has been seeing a surge in new frameworks within the past year, and it's exciting to see. Laravel has been an absolute joy for me to use and touch on new concepts, as well as force me into handling many redundant pieces of development from the command-line. While the framework itself is opinionated in its use of certain packages (such as Monolog, Carbon, and Symfony's Routing component), it makes effective use of all of them. With these new tools at our disposal, rapid-development of high-performance custom applications seems far less daunting than it used to be.
These are exciting times, and I can't wait to see what comes up next in the world of PHP.Written by maiorano84 on Wednesday February 18, 2015