Categorías
Blog
General
Tech Blog

Be one with your framework

PHP is undeniably a language that has evolved dramatically ever since it was born in 1995. Backend development technologies have always been somewhat discriminated against by the developer community, predominantly by supporters of frontend development technologies, which show results almost instantly. However, PHP has always occupied a particularly special place on the list of backend technologies.

Perhaps that is why, over the past few years, we have seen several new frameworks that have become increasingly popular, as is the case with Laravel. In 2013 Laracon, the very first annual gathering for developers of this open-source PHP web framework, was held.

Laravel role in IT Certification preparation applications development

Laravel has allowed Media Interactiva to create Pedagoo, an educational platform that comes with a series of applications that are used by more than 20,000 users on a monthly basis. Users include students that want to prepare for and obtain IT certifications from Microsoft, Cisco or CompTIA, teachers that manage student groups and progress reports and that create and distribute exams, as well as editors that build their own tests with their own content, recurring to more than 10 different question types.

But what makes Laravel different? What are its advantages with respect to other frameworks like Symfony?

Roughly, we can say that Laravel’s learning curve is quite comfortable and that the framework is supported by a large community. Due to its simplicity, you do not need to be an expert to start programming. Laravel gives you the freedom to create structures based on your needs, and its comprehensive number of packages and components makes it easy to focus on the business logic of the project.

Special mention should go out to the following Laravel features:

ORM to rule them all

Like other frameworks such as Django or Ruby on Rails, Laravel has its own ORM (Object Relational Mapping) called Eloquent. ORM makes it easy to convert data between the type systems used in OOP and relational databases. This facilitates applying certain orientation characteristics to objects such as inheritance or polymorphism.

More than just MVC

Until Laravel 4, the framework followed a pattern that was quite similar to Model View Controller. As from version 5, it started to go a little further. Laravel incorporated a routing system that parsed URLs and assigned them to a method in a controller. It also permitted representing Middleware, which restricts certain areas of the application based on client status, whether it is a user or another application or service.

That is why many people claim that Laravel is not an MVC framework, starting with Taylor Otwell, the creator of Laravel, himself.

PHP framework for artisans

PHP framework for artisans reads the slogan of Laravel. Laravel incorporates a command-line interface (CLI) that interacts with the application itself called Artisan. This CLI is based on Symfony and provides a variety of commands that help developers perform certain tasks during development itself, or even with the application already in production.

The possibility to execute migrations that alter the database structure and that allow us to have all the applied changes in code (which will usually be versioned), offer the possibility to even reverse those changes. Moreover, seeders allow extracting processing and injecting data in another database in a simple and secure way. As with migrations, seeders also allow having version control of those data movements.

Dependency management and Control Investment

As mentioned before, Laravel might not be an MVC framework, but it definitely is an IoC container. This is one of Laravel’s most used features, which is at the same time the most difficult to understand.

Contrary to the classic procedural code, Laravel allows the Inversion of Control amongst others thanks to dependency injection. This permits instantiating classes and does away with their dependence on other classes.

This was achieved by encapsulating the most common code in separate layers. In Laravel, it is the common code that calls the specific code, for example by routing and reaching the specific code by injecting itself with the dependencies it needs.

 

Laravel

It may interest you | How Kubernetes is improving Media Interactiva workflow

What’s new in Laravel 6

Laravel 6 was released in September 2019. It is a LTS (Long-Term Support) version, which means that it comes with long-term support. It will receive bug fixes for 2 years plus one of security fixes, although the release cycle remains: a larger version is released every 6 months and minor versions are released on a weekly basis.

Highlights include improvements in Eloquent subqueries thanks to the inclusion of new methods that allow including them more elegantly and with even better performance.

Views and other frontend-related elements that the default framework used for user registration and authentication were also removed. All this has been included in a new Composer package called laravel/ui, making it more agnostic and allowing frontend development in a separate package of the framework.

Yet another big innovation is the inclusion of Job Middleware, which works in a similar way to classic Middleware, applying its logic to a work queue instead of to a request.

Microservices

Nowadays, there are many projects that do not need full framework power, either because they are very simple, or because they need a lot of speed. That is why, ever since 2015, there is Lumen, a lighter version of Laravel that is more oriented towards API and microservice creation. In short, we can say that Lumen is a micro-Laravel that comes with some of its main features like Eloquent, cache management, validations, routing, and middleware.

Excited about what you just read? Let us know! We are continually looking for developers to join our team. Visit our website and discover our job openings!

 

Jesús Vazquez

Senior Developer