Last month, when starting a new project, we debated about which framework to use to start the project with. It’s true, today it is hard to imagine building a complex web application from scratch without a well structured framework.
At Conceptualize we design and build bespoke solutions for the online world. Most of what we design is coded using various technologies, however the underlying server side code primarily is PHP. With the launch of PHP 7 and the new features it brings, our loyalty towards PHP stands, and we still enjoy working with it.
Many popular languages for web development have their “default” framework – Ruby for Rails, Django for Python. PHP on the other hand has a variety of options to choose from.
According to Google Trends & Github, Laravel is the most popular PHP framework with 29K stars on Github. Often termed as a “rapid development” framework, Laravel was created by Taylor Otwell as an attempt to provide a more advanced alternative to the CodeIgniter framework, which did not provide certain features such as built-in support for user authentication and authorization.
So why Laravel
As an agency, the choice was highly influenced with the fact that just about everyone in the dev team has hands on experience in using Laravel since version 3 (at the time of writing this article, Laravel is at version 5). Apart from that, here are the top 3 reasons for choosing Laravel;
Laravel Core and Routing
Laravel designers didn’t spend too much time reinventing the wheel. A lot of solutions and practices are transferred from other frameworks and simply made better. A good example of this approach is the extended Symfony console called Artisan, which is a command-line interface included with Laravel.
Routing in Laravel is amazing; it is very similar to the Ruby on Rails (RoR) implementation. You can easily group routes, create resources for CRUD pages, attach filters and automatically bind models to the request parameters.
Versioning can be implemented as a group on the top level for all nested routes by using a prefix. So for example, if we were to write an API for a mobile application, and decided to upgrade the API with a new release, we can still easily maintain a previous version of the API considering that mobile app users will take some time to update their apps.
Laravel uses Eloquent ORM
ORM stands Object Relational Mapper. Ask any developer the importance of an ORM in web development, grab a cup of coffee and listen to how bad things can get without an ORM when the application scales. The Eloquent ORM included with Laravel provides a beautiful, simple ActiveRecord implementation for working with your database. Each database table has a corresponding “Model” which is used to interact with that table.
The Eloquent documentation on Laravel is very comprehensive and detailed. We suggest reading through it as a start towards Laravel web development.
Long running tasks are a common bottleneck in web applications. Using Queue in Laravel is a great way of handling and queuing long running tasks in the background. We usually use Beanstalk when it comes to running queues with Laravel. Queues are great for tasks like saving data. They can be used to repeat failed jobs, add sleep timeouts before executing jobs, etc.
Wait there is more
There is a whole bunch of other technical aspects that we use Laravel for;
- Unit Testing
- Setup homestead Vagrant box prepared for development using Laravel and configured local environment
- Adding endpoints
- Adding authentication layer. We usually use Sentinel to add a bit more functionality to the base packaged authentication.
- Adding filters before/after application execution
So to summarise on a general level, we enjoy working with Laravel as our choice for a PHP. Quick and functional core that can be extended, clean and simple routing, effective ORM and database layer, easy integration with third-party libraries and an active and growing community that can provide quick support and answers is why we love Laravel