the PHP Laravel it is a framework application, based on a project Open Source – Open Source Code, intended for the development of web systems, with expressive and elegant syntax. It is developed in the PHP language, being easy to adopt and learn.
Its first public version was a beta released in mid-2009.
Its web framework provides an infrastructure and starting point for building your application, allowing you to focus on the business rules of your software.
Let it framework take care of the details such as data sanitization, user input validation rules, HTTP request header handling, HTTP response structure formatting, among many other technical features.
O framework Laravel strives to provide a great developer experience by providing powerful features such as full dependency injection, an expressive database abstraction layer, queues and scheduled jobs, unit and integration tests, and much more.
Whether you're new to PHP or web frameworks, or have years of experience, Laravel is a framework that can help you grow as a developer or team.
Frameworks are known for delivering a series of good practices and consolidated design patterns to ensure a robust software architecture, Laravel fulfills this role well.
Now that you know what the PHP Laravel Framework is, learn about its structure and quality in the following topics. Be sure to also read the article that presents a complete overview of the PHP Laravel Framework Architectural Components.
Laravel Framework Overview
Laravel is the best choice among PHP frameworks for building modern, robust and scalable web applications.
Both the Laravel framework in yourself, like its other original packages follow Semantic Version Control – SEMVER.
Major versions (major) of the framework are released annually around September, while minor versions (minor) it's from patch can be released on a weekly basis. Minor versions and patch should never contain major changes that break compatibility.
[without seeing]: Semantic Versioning – Semantic versioning: official documentation in https://semver.org/lang/pt-BR/
At the time of writing this article Laravel is in its number 8, as main features it maintains the improvements made in Laravel 7.x introducing Laravel Jetstream, model factory classes, squashing of migrations, job batching (batch of jobs), limitation of rate improved, queue improvements, dynamic Blade components, paging views with tailwind, helpers for timed tests (time tests), improvements in
artisan serves, improvements of listener and a variety of other bug fixes and usability improvements.
For a more in-depth breakdown of the improvements in this release, read the article Laravel 8.
Know now the general characteristics of the project and the Laravel Framework:
The project provides tools and components to increase the productivity and quality of the projects developed.
LTS versions (Long Term Support – Long Term Support) ensure that certain versions of the framework will receive bug fixes for 2 (two) years and fixes for security issues – security fixes, for 3 (three) years. For other versions, in general, bug fixes will be carried out for 7 (seven) months and security for 1 (one) year.
For LTS releases such as Laravel 6, bug fixes are provided for 2 years and security fixes are provided for 3 years. These releases provide the longest support and maintenance window.
For general releases, bug fixes are provided for 18 months and security fixes are provided for 2 years. For all additional libraries, including Lumen, only the latest version receives bug fixes.
|Version||Release||Bug Fixes until||Security Fixes until|
|6 (LTS)||September 7, 2021||September 6, 2022|
|7||March 3rd, 2020||October 6th, 2020||March 3rd, 2021|
|8||September 8th, 2020||March 1st, 2022||September 6th, 2022|
|9 (LTS)||September, 2021||September, 2023||September, 2024|
|10||September, 2022||March, 2024||September, 2024|
The core team of the Laravel project likes to call it a “progressive” framework. By that, they mean that Laravel is able to follow the growth of your project and, in the case of junior or beginner programmers, your professional development.
If you are just taking your first steps in web development, in addition to the vast library of documentation, guides and tutorials, it is important to know that the community around the project is very large, worldwide in scope and with excellent professionals willing to help beginners.
Are you a senior developer? Even better, Laravel offers robust tools for dependency injection, unit testing, queuing, real-time events, and more. The framework is tuned to build professional web applications and ready to handle enterprise workloads.
The PHP language, when used with good concepts of software architecture, offers high scalability to the systems created with it. So it's easy to understand how incredibly scalable Laravel can be.
In addition to PHP's scaling-friendly nature, thanks to the excellent architecture employed in the Laravel framework, and the built-in support for fast and distributed caching systems like Redis, scaling horizontally with Laravel is very simple. In fact, there are hundreds of commercial Laravel apps that have easily scaled to handle hundreds of millions of requests per month.
Need extreme scaling? Platforms like Laravel Steam allow you to run your Laravel application at nearly limitless scale on the latest serverless technology from Amazon AWS.
Laravel organizes the best packages in the PHP language ecosystem into its structure to provide the most robust and developer-friendly framework available. In addition, thousands of talented developers from all over the world contribute to its structure. You can even become a Laravel contributor, check, for example, my accepted contributions to the project: @nunomazer PRs.
Design Patterns in Laravel
Being a framework that employs a robust software architecture, valuing good practices of development and structuring of the source code, it employs several design patterns – software design patterns, in your infrastructure.
The following list presents the main design patterns implemented by the Laravel framework and describes an overview of each one:
MVC – Model View Controller
Model-View-Controller is a software architecture pattern that separates information representation from user interaction control and business rules.
O model (model) is responsible for managing application data, business rules, logic and functions.
THE eyesight (view) is any output representing the data, such as an HTML canvas, report, table, or dataset in JSON or XML format. It is possible to have multiple views of the same dataset, such as a bar chart for management and a tabular view for a record.
O controller (controller) mediates the input (customer requests), converting them into orders for the model or view. The controller is responsible for managing (orchestrating) the flow of service to a request.
In software design patterns, a façade (“facade” in English, a word of French origin; commonly
written in English without the cedilla, but still with the /s/ sound: facade) is an object that provides
a simplified interface to one of the features of an API, for example.
A façade can make a software library easier to understand and use, or reduce dependencies on a library's internal features.
An application is a cohesive aggregation of services.
While an application offers a broad set of functionality in terms of programming interfaces (APIs) and classes, a service provides access to some specific functionality or features. The service defines interfaces to functionality and a way to retrieve an implementation.
For example, consider an application that provides a variety of information about a geographic location, such as real estate data, weather information, demographics, etc. The weather service, a part of the application, can set only the interface to retrieve the weather information.
The service provider interface (SPI) is the set of public interfaces and abstract classes that a service defines. The SPI can be represented by a single interface (type) or abstract class or a set of interfaces or abstract classes that define the service contract.
IoC – Inversion of Control
Inversion of Control (IoC) is the name given to the pattern of computer program development where the sequence (control) of method calls is inverted in relation to traditional programming, that is, it is not determined. directly by the programmer.
This control is delegated to a software infrastructure often called a container or any other component that can take control of the execution. This is a very common feature in some frameworks.
In Laravel the entry point of requests is unique, by the file
public/index.php, which instantiates the main controller, or front controller, which is responsible for the inversion of control, identifying by the parameters of the request which method of which controller should respond to it.
DI – Dependency Injection
dependency injection (Dependency Injection) is used to keep the coupling between different modules and components of a system low.
In this pattern, the dependencies between the components are not defined by direct instantiations of the programmers, but by the configuration or use of standardization of a software infrastructure (container) that is responsible for “injecting” its declared dependencies into each component.
Dependency Injection is related to the Inversion of Control pattern but cannot be considered synonymous with it.
Front Controller and Dispatcher
The software design pattern front controller defines a single entry point for your web application that handles all HTTP requests. For example in PHP:
index.php, in Laravel specifically
This code is responsible for loading dependencies, executing security rules, internationalization, user authentication.
Used in conjunction with the design pattern dispatcher, uses strategies for the MVC application where the controller module (front controller) sends the processing to a distributor (dispatcher) that selects, based on the context of the request (parameters received by the HTTP request), the correct controller for executing the logic related to the request made.
Front Controller is a design pattern that, together with MVC, enables the implementation of IoC – Inversion of Control in Web systems.
Defines a one-to-many dependency between objects so that when an object changes state, all its dependents are automatically notified and updated.
Allows interested objects (observers) to be notified of state changes or other events occurring on another object.
The Observer pattern is also called the Publisher-Subscriber, Event Generator and dependents.
In the Laravel framework it is implemented with the concept of listener.
ORM and ActiveRecord
ORM (Object Relational Mapping – Object Relational Mapping) is an approach used to persist information from business objects (application) in a relational database (SQLite, Oracle, Sybase, PostgreSQL, Mysql, etc).
It performs, through annotations in the classes that will represent the entities in memory, in the object-oriented pattern, the mapping with the tables and fields of the relational database.
active record is a design pattern where the interface of a given object has actions to manipulate its data, such as Insert(Insert), Update(Update), Delete(Delete) and properties and access actions that correspond directly to database columns associated.
An instance of an object is associated with a single record (tuple) in the table. After creating and saving an object, a new record is added to the table. A loaded object gets its information from the database
of data. When an object is updated, the corresponding record in the table is also updated.
Features and functionalities
To end the presentation of the framework, we will list some of the features delivered to the developer natively in its structure, providing productivity and security for your application.
The Laravel framework provides the implementation of standardized authentication in a simple way. This feature simplifies the development of applications with little complexity and simple authentication requirements, for systems with specific requirements, such as using access directories (eg LDAP), OAUTH, it is possible to override the default implementation.
It even offers packages for implementing token authentication for RestFul APIs.
Modeling routes to service requests for resources and functionality of your system.
It also offers limit control of requests per minute and per client IP.
The framework easily protects your application from cross-site request forgeries (CSRF) attacks; applies sanitization of data inputs and allows the implementation of middleware for other filters if necessary.
Provides a unified API for multiple application caching systems. By specifying a driver, the framework uses it by default throughout its application.
Laravel supports tools like Memcached and Redis. By default it is configured to use the drive file, which stores serialized objects in the file system. For large applications, it is recommended that you use an in-memory cache such as Memcached or APC.
Events in Laravel provide a simple implementation of the observer pattern, allowing classes
ses/objects subscribe to and listen to (listeners) events in your application.
Event classes are typically stored in the app/Events directory, while their listeners are stored in the app/Listeners directory.
An example of use would be creating an event
UserCreated, which, when triggered, allows its listeners to perform actions of sending email, creating specific profiles, validating access after creating a user.
If your development stack is based on the PHP programming language, but even if you work in a company or team that does not adopt Laravel the framework, it is essential to know its application potential and, at least, to have an overview of its characteristics and functionalities because, with about 22 million downloads by site metrics packagist.com, the same should not be ignored.
However, if your interest is to know more about this framework, you want to adopt it in your stack and you want to learn how to program in Laravel, follow this blog to receive articles about best practices and problem solving the “Laravel way”.
keep up to date
Don't forget to follow me on twitter and sign the Mazer.dev channel on Youtube to receive updates on new articles, materials on PHP, Laravel, Git and Web programming – video lessons and free courses in software development and engineering.