Web application development usually consists of two main parts. Work on the server-side or back-end part includes server preparation, database structure development and interaction with the client side. The client-side or front-end is the process of creating pages visible to a user in his/her browser. This part includes the following: design, layout, animation and interactive elements creation, as well as interaction with the server. Two groups of developers usually work on these parts simultaneously. However, one person is sometimes responsible for these tasks, and the process itself is called Full Stack development.
To date, there are a large number of web frameworks that simplify and speed up the development of web applications, but they are all narrow-focused, namely, they allow working only with one (front-end or back-end) project’s parts. And only a few frameworks effectively make it possible to combine these two components into one project. Laravel represents one of such frameworks.
Laravel and databases
The development of any web application includes the design, development and maintenance of databases. The tools provided by Laravel make it possible to effectively perform all three processes without writing a single line of the SQL code:
– Schema is a class that is designed to create, delete and change the structure of tables in the database.
– DB is a class intended to work with data stored in tables (request execution, work with transactions).
– Eloquent ORM is an implementation of the ActiveRecord template that allows working with database tables as “models.”
– Scout provides mechanisms for creating a full-text search in models.
– Migrations are like a version control system for the database and allow effectively modifying the database development and maintenance in a team.
Laravel and the back-end
Laravel is a typical PHP web framework designed to develop web applications in accordance with the MVC pattern (Model – View – Controller). Therefore, everything the developer needs is the following:
– Create a set of models that will be responsible for data receiving and storage.
– Create a set of views that will present this data. Laravel implements this mechanism using its own Blade templating engine
– Create a set of so-called “routes” that will process requests, receive data and formulate an answer. For convenience, the entire business logic of the application is grouped in the controllers, although it is possible to process requests directly in the router.
The range of finished solutions Laravel offers to developers is quite broad. First of all, it is related to setting up the development environment. Using Homestead (for Linux users) or Valet (for Mac users), you receive a virtual machine with everything you need to start the development:
– Web server
– MariaDB (5.1+)
And the list of finished tools and services offered to the developer strikes the imagination with its diversity:
– Artisan is a command line interface. It allows starting commands that will be useful while building the Laravel application.
– Route is a class that contains a set of methods for quick routes creation.
– Middleware provides a convenient mechanism for filtering HTTP requests, the application processes.
– Request is a class that contains a set of methods for processing HTTP requests
– Response contains mechanisms for forming a server response. The main types of responses are View, JSON, File Downloads and Redirect.
– Session is a class for working with sessions.
– Validation contains mechanisms for validation of incoming data. Laravel provides several different approaches to data validation.
– Authentication and Authorization contain tools for users’ authentication and authorization.
– Cache is a class for working with a cache. The database, Memcache or Redis can be used as a cache driver.
– Collections is a class that provides a set of methods for working with data arrays.
– File Storage is a class for working with file storage (local file system, S3, FTP). This class contains methods for the files uploading and downloading, as well as working with them.
– Mail contains mechanisms for sending e-mails.
– Jobs and Queues. Laravel allows developers to easily create console commands, configurate them in queues or enter them into the scheduler.
– Helpers is a set of functions for working with arrays, lines, URLs, project settings, cache and logging.
Laravel and the front-end
Unfortunately, Laravel is a PHP web framework, and it does not contain finished components that can be used in the front-end development. However, creators provided developers with everything necessary for a quick start.
Laravel project contains a finished package.json file with a set of libraries that are used in almost every project, jQuery, lodash and axios. Developers who favor a variety of JS frameworks will appreciate the preset mechanism. It enables the developer to quickly change the tools that will be used in the application development. Changing the preset will automatically generate a new package.json with the connected libraries which are necessary for working with the appropriate framework. Today , Laravel supports the following:
– Vue Preset is a project using the Vue JS library.
– React Preset is a project using the React JS library.
– Bootstrap Preset is a project using the Bootstrap framework.
– Delete all settings.
It is also possible to install additional sets from Github.
During the development and after the completion, a project should periodically be “assembled ,” namely combine all modules into one or several files. Laravel Mix will be useful to provide a set of APIs to determine the basic Webpack steps for building your Laravel application. The developer creates own asset pipeline using simple methods.
Laravel Mix contains the following methods:
Working with CSS scripts
One of the following commands should just be executed to start the build procedure:
– npm run dev
– npm run production
– npm run watch
– npm run watch-poll
The main task that the creators of Laravel set is to make the development process convenient and easy, ranging from server setting to assembly and deployment of the finished product . In addition, they managed to create a really versatile tool. This is clearly demonstrated by the diversity of projects developed by our company on the basis of this framework.
For example, we have developed the S3 Web Browser for projects that use Amazon S3 as a data storage. This is, in fact, a full-fledged file manager that allows the user to work directly in the browser with files and folders hosted in S3. But Metatron is more complex . It allows registered users to upload video files (from a computer or following a link) and to launch video conversion and analysis (contextual keyword searches). A powerful search engine of video content will be created based on this data. Besides, Laravel is highly suitable for designing large projects, such as Zantepay. This portal is created within the framework of the ICO project to promote new crypto currency Zantecoin (ZNX) on the market. Registered users can buy or exchange crypto currency, receive bonuses, participate in a referral program and have many other opportunities. The portal is actively developing and already has about 10 thousand users.
I recommend that everyone should try this amazing framework and become a part of the universe named Laravel. This universe is constantly growing and improving itself so you have the opportunity to contribute to it.
Autor: Andrey Kambur, Full stack developer