Pros and Cons of Laravel Framework
Laravel is the most popular in the PHP MVC Framework for building web applications. In this article we will review what makes it so popular and what can still be improved.
One of the main advantages of Laravel is great documentation. It is very well-structured, making navigation a breeze. Official documentation has various code samples and covers not only built-in features, but also external libraries. The documentation also explains how to set up a local dev environment using Homestead or Valet.
Vast Laravel ecosystem is another advantage. Going through documentation you can get a sense how mature Laravel ecosystem is. It all starts with bread and butter of any MVC framework: Models, Views and Controllers. On top of that Laravel comes with a command-line interface called Artisan. It makes the development process faster by automating tedious tasks. For example, one command creates a model, database migration and resource controller (CRUD). Then another one generates a seed test data. Then the third one populates database with a seed data. It all saves a lot of time.
Laravel uses “Eloquent ORM” which allows to work with database objects and relationships using a beautiful syntax. Besides providing a beautiful interface to query data from database it also takes care of data validation. Request can be used to process and save data applying Laravel’s validation rules.
Laravel also comes with built-in solutions to send mail & notifications, work with queues, schedule tasks, cache data and so much more. It simplifies REST API development with API Resources. There are also a lot of plugins available created by the core Laravel team. For example, Cashier provides an expressive, fluent interface to Stripe’s subscription billing services. Passport provides a full OAuth2 server implementation for Laravel applications in a matter of minutes. While Socialite supports authentication with facebook, twitter and other social networks.
There are many learning Laravel resources available online. Laracasts is the website with tons of Laravel screenscasts. There are over 1500 video lessons for beginners and experts. Topics range from dev environment setup to writing clean code, working with queues and unit testing. Thanks to massive Laravel community it is always easy to find an answer for any question.
Now let’s talk about cons… Laravel has them just like any other framework. Some of them are just the flip side of the coin of Laravel benefits. For example, the documentation might be well-structured but not very easy to grasp for newbies. New Laravel developers might use documentation samples incorrectly. For example, they can use Validation in controllers instead of putting it into a separate Request file.
Eloquent ORM might generate suboptimal SQL queries for complex queries. It could make application slower by increasing the response time from the server. Therefore, it is sometimes necessary to handwrite write complex SQL queries.
Another Laravel con is abundance of frontend libraries it is packaged with. Often you need to clean up default list of libraries in the packages.json and even delete some basic css and js files.
Another problem is the absence of backwards compatibility. There are breaking changes between major versions. Therefore, it might be challenging to upgrade the outdated application to the latest version. For example, the folder structure had minor changes in Laravel 5.3 compared to Laravel 5.2. Such upgrades always take time to make sure everything has been correctly upgraded and functions properly. Laravel team goes a long way to support previous versions though.
Overall Laravel is a great framework. Fantastic official documentation is a great resource. Multitude of official and 3rd-party components make development process enjoyable and fast.