Some time ago I wrote about frameworks and whether it is worth using them at all. Once you decide to use a framework, the real question becomes: which one should you choose and why?

I plan to write a series of posts about the frameworks I know and have worked with, starting with Laravel. In my opinion, it is one of the most practical and easiest to learn.

Laravel is an MVC framework that has been at the top of Google search trends since August 2014, the year the 5.0 version was launched. Before that, it was already used, but it was not as prominent as it is today. I started using Laravel in 2015 and that helped me understand object orientation and the MVC pattern much better, because the framework organizes projects in a very structured way.

In 2016 I started using Ruby on Rails, and that experience enriched my understanding of Laravel. I cannot say with certainty, but Laravel seems to have been influenced by Rails, especially in the way it separates routes, controllers and models.

Framework characteristics:

- Language: PHP - Databases: MySQL, PostgreSQL, Redis, MongoDB, Cassandra and SQL Server - Database models: relational and object-oriented - Features: scaffold, internationalization (i18n), TDD and the “don’t repeat yourself” principle

The databases listed are highly compatible with Laravel. You only need to change the configuration and point the app to the database you want. If the schema is already ready, it works immediately. If not, you can run the migrations and the structure is created automatically. Everything works as long as the database is modeled in a relational or object-oriented way, which are the two models the framework supports.

One feature that is widely used, especially by newcomers, is Scaffold. It creates the full CRUD for an entity in the system, such as car dealerships, for example. You run the scaffold for vehicles and the read, view, write and delete flows are generated automatically. In a short time, you can already see the functionality working.

Another important point is internationalization (i18n), especially if you plan to build a system accessible in multiple languages. Even if you are not using it for that purpose, it can help keep text centralized in one place. If a phrase needs to be changed, you edit it once and the change is replicated throughout the system.

To start a project with Laravel, if you have Composer installed, just run:

composer global require "laravel/installer"

Once PHP is configured in the environment variables, just run:

php artisan serve

That starts the application locally and leaves the project ready to run.

Did you like Laravel? Want to know more? Check out the official documentation and the GitHub project. If you have any questions, suggestions or want to read about another framework in particular, leave a comment.

Locaweb Insights