PHP, as it’s known today, is the successor to a product named PHP/FI. Created in 1994 by Rasmus Lerdorf, the very first incarnation of PHP was a simple set of Common Gateway Interface (CGI) binaries written in the C programming language. Initially used for tracking visits to his online resume, he named the suite of scripts “Personal Home Page Tools,” more frequently referenced as “PHP Tools.” Over time, users requested more functionality, and Rasmus rewrote PHP Tools, producing a much larger and richer implementation. This new model was capable of database interaction and more, providing a framework upon which users could develop simple dynamic web applications such as guestbooks. In June of 1995, Rasmus » released the source code for PHP Tools to the public, which allowed developers to use it as they saw fit. Open source PHP also permitted – and encouraged – users to provide fixes for bugs in the code, and to generally improve upon it. (Read more)
A PHP Framework is a collection of files that, organized together to make development easier. A framework provides an application design pattern that separates the application data and business logic (model) from the presentation (view). MVC stands for Model, View & Controller.
The controller mediates between the models and views.
I like to think of the MVC design pattern as a car and its driver.
The car has the windshield (view), which the driver (controller) uses to monitor traffic ahead, then speed up or slow down (model) depending on the demands of the road and the traffic.
Why using a Framework
Frameworks direct and simplify working with sophisticated technologies by:
1- Concealing all the intricate implementation details
2- Providing standard methods that we can use to build our applications.
3- Increased developer productivity; this is because the base implementation of activities such as connecting to the database, sanitizing user input, etc. are already partially implemented.
4- Adherence to the MVC (Model-View-Controller) pattern that ensures the separation of presentation and logic
5- PHP frameworks make agile development possible.
My Selection of PHP Frameworks
In this article, I have picked 3 top PHP frameworks and provided a brief overview of each:
Laravel is rated the top PHP framework by many professionals and developers, although its a relatively new PHP framework. Taylor Otwell developed Laravel as an alternative to CodeIgniter in 2011.
Laravel ecosystem is vast, with an instant hosting and deployment platform.
Laravel’s official website provides tutorials called Laracasts.
Laravel has many features that make rapid application development (RAD) possible. The Artisan command-line interface provides several helpful commands while developing the application. Laravel has a powerful templating engine too, which enables everyday tasks such as authentication, caching, sessions, RESTful routing, Object-Relational Mapping, and queuing easier for developers.
Laravel also includes a local IDE (Integrated development environment) called Homestead, which is a packaged Vagrant box. You can develop a project in Laravel relatively quickly with the pre-packaged Homestead bundle with Vagrant.
Symfony framework by French company Sensio Labs offers a lot of reusable components, libraries, and packages.
When it comes to developing large-scale enterprise projects, Symfony makes a perfect choice among PHP frameworks. Many content management systems such as Drupal, PHPBB, Piwik, ORO CRM, and even the popular Laravel itself, use the components of the Symfony framework.
Symfony, in terms of structure, is a flexible full-stack and uses Twig as a template engine.
- By using Bytecode caching, Symfony has a high performance.
- Reusable PHP libraries are assisting developers in tasks such as routing, authentication, templating, and many others.
- Excellent support system.
- Easy to use and maintain.
- Provides RAD.
- Support MVC architechture.
- Stable and well-documented.
The website of Symfony has an excellent showcase section where you can take a peek at the projects developers accomplished with the help of this handy framework.
CodeIgniter is one of the oldest frameworks. It has been around since 2006 but is simple and powerful.
It can easily be installed and requires configuration.
Symfony works perfectly on almost all shared and dedicated hosting platforms.
CodeIgniter lacks on the MVC framework. Models and Views are optional, but Controller classes are required. You can use your coding and naming conventions, evidence that CodeIgniter gives great freedom to developers.
CodeIgniter is a lightweight framework. It’s only about 2MB, so it’s a lean framework, but it allows you to add third-party plugins if you need more complicated functionalities.
Another strength of CodeIgniter is speed. It runs faster with database tasks in comparison to other frameworks. CodeIgniter is well documented and an excellent framework to start with for PHP beginners.
There are several other great PHP frameworks for you to choose from, but my focus meant to be only on the most popular and most used Frameworks.
When choosing a framework for your PHP project, the size, and scope of the project, hosting requirements, delivery time-line, available skills, and other variables are highly relevant.