In the world of web development, the Laravel framework is one of the most powerful and useful PHP frameworks out there. Laravel was created by Taylor Otwell and has been in development for 7 years as of this June. It has been very successful throughout its development: one of the biggest reasons attributed to Laravel’s popularity is the documentation, as this is extremely extensive but also very clear and concise.

You can learn more about what exactly Laravel is in our explainer blog post.

MVC

Ever since its inception, Laravel has prided itself on its MVC architecture. MVC stands for model, view and controller and each of these sections have a role. First of all, the model defines any objects i.e. database tables that are used within the website, the view is responsible for the overall presentation of the website and finally the controller is where all main functions are stored for the website. This kind of design helps distinguish between code for the frontend and the backend easily; the frontend being anything that is displayed to the user via the view files and the backend being any of the functions being used in the controllers.

Laravel 5.6

During Laracon on February 7th this year, Laravel 5.6 was released. This version introduced some new features that will help developers in the production of their web apps. For instance, with the new update you can log to Slack – this will be invaluable to companies like ours since we use Slack for communication within the company. Being able to view the logs as they are created on slack will be incredibly useful. Another feature that is also to do with logging, is artisan logging. Artisan is the command line interface that allows the creation of models, controllers, views etc. and other useful commands like migrations which allow this interface to communicate with the database in order to make sure all tables are up-to-date! Bootstrap 4 has now been integrated with the front-end scaffolding making it easier to manage the views with the latest version of Bootstrap.

Spark 6

Along with Laravel 5.6, Spark 6 was released which is a micro-framework for the creation of subscription type services. A unique feature with Spark is that it allows you to fully customise how you bill your users, it has built in functions for billing per team, per user or even per project. Although, compared to your standard Laravel build this is a bit different since most of the backend is not php instead they have used a javascript framework called Vue js. The new updates to Spark included an updated UI, which gives the site a much more modern look. Also localisations have been added to the build, which allows for easy translation on the site in different countries e.g. where some countries read from right to left there is a built in function Spark::useRightToLeftTheme();. Stripe has been thought of in this latest release since Stripe elements are now supported out of the box. An upcoming project that we have been working on is being built with Spark 6: since this new project will be a SaaS (Software as a Service), it will heavily benefit from Spark’s built in subscription services and features.

Lumen

Although Laravel is very expansive and has a great deal of functionality, it is sometimes too much and not all of it is needed, hence why Laravel Lumen was released in 2015. Lumen is a more streamlined version of Laravel which has been stripped of any features that aren’t essential and are not commonly used. This has been done to increase website performance due to the reduced amount of resources that have to be imported on load of the site. However, Lumen still keeps all of Laravel’s core features like the MVC architecture and some basic functionality like Eloquent and AUTH (some of this content may need to be uncommented in the app.php file in the bootstrap folder). We have had first hand experience with Lumen when we used it to create our gift generator in December of last year. We were very impressed by the speed of the load times and this contributed to the short timeframe that was needed to develop the site and helped with its success. One last amazing feature about Lumen is that if you decide that you will need Laravel’s extensive list of features over Lumen’s speed, then you can upgrade seamlessly into a Laravel build with very little hassle!

How to use Laravel

Laravel is very easy to install – all you need to get started is composer, which you can get from here. Firstly you’ll need to install the laravel installer via this command:

composer global require “laravel/installer"

NB: You will need to have your composer’s bin directory in your system’s $PATHvariable, for MAC it is located here $HOME/.composer/vendor/bin.

Next you should be able to use the laravel installer on command line and create your new project via this command:

laravel new {Your Project Name}

You will need to create a new .env file in the project’s root directory which will store all the necessary details like a random APP KEY which can be generated by the php artisan key:generate command. There is an example .env file within the root directory to help you get started. This is also where you should store your database details so that your web application can communicate with your database. One last thing you will need to run php artisan migrate once your database credentials are in place to run the basic migrations that are included with your installation. Then your new Laravel project should be good to go!

As a company we use Laravel for the majority of our websites, and this has given us the ability to rapidly create and innovate website solutions and bespoke CRM-style web applications. Examples include Musician Go and Contribute, both of which have been developed using the Laravel framework. Furthermore, there is a CMS called Pyro that is built on Laravel – this is geared towards web developers and we have previously written another blog post on this should you want to find out more.

To conclude Laravel is a very powerful and useful framework to have in any web developer’s arsenal; especially for a PHP developer!