< Back
November 24, 2020

What is the Laravel framework?

A quick overview of installing the Laravel PHP framework for quicker and easier software development
laravelphpwebframework

Written by:

Ricardo Aranha

Laravel is a powerful web framework developed with PHP that allows developers to spend less time laying down the foundation of the project and spend more time in the actual development. It already comes with a lot of the basics pre-configured, things like database connections, mailing, authentication, translations, template engine, Vue.JS pre-installed, and many more that demand time to configure every time you start a new project.

The framework also follows the MVC (Model-view-controller) pattern, the most popular in web development, giving you the tools to write more clear and efficient code. The goal of this article is to guide you through the steps of installing, configuring, and starting your project with Laravel.

What do you need to start using Laravel?

Laravel offers you the Laravel Homestead, an Ubuntu virtual machine that includes all the software you need, such as Apache, Nginx, Git, PHP, and MySQL. Although it is good to start with this approach, I’ll focus on the most universal path for starting to use Laravel, but feel free to check out the Homestead and see if it can be of use to you.

To start with Laravel without the Homestead you will need to have PHP installed—Laravel works with different PHP versions, but here we will focus on PHP 7+. There are many ways to install PHP: you can install it stand-alone with a web server of choice (if you are a Linux or Mac user you can follow the LAMP or MAMP software stack) or with web servers stacks packages such as XAMPP, WAMP or EasyPHP. All of these options come with a web server (Apache or Nginx) and SQL database, and most import PHP. This should include all of the essentials you need to start using Laravel.

After installing PHP, make sure you have the following extensions. All of them are required for Laravel to work with its full capacity (depending on the framework’s version):

BCMath PHP Extension
Ctype PHP Extension
Fileinfo PHP extension
JSON PHP Extension
Mbstring PHP Extension
OpenSSL PHP Extension
PDO PHP Extension
Tokenizer PHP Extension
XML PHP Extension

Now that you have PHP installed, we can move to the next step. To install Laravel you will need to first install Composer, a dependency management tool for PHP (can also be used to install any missing extensions). For Windows users, you just need to download and run the Composer setup. If you are on Linux or Mac, you can follow the command lines below:

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

php -r "if (hash_file('sha384', 'composer-setup.php') === 'e5325b19b381bfd88ce90a5ddb7823406b2a38cff6bb704b0acc289a09c8128d4a8ce2bbafcd1fcbdc38666422fe2806') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

php composer-setup.php

php -r "unlink('composer-setup.php');"

After this open your command prompt/terminal and type:

composer global require laravel/installer

Wait for the Laravel installation to finish, then navigate to the folder where you want to start your project and type:

laravel new YOUR_PROJECT_NAME

Alternatively (or if your system can’t find the Laravel command), you can also use Composer for this by typing:

composer create-project --prefer-dist laravel/laravel YOUR_PROJECT_NAME

Once you finish this step you will have your Laravel project working and ready to start developing. You can use Apache/Nginx to serve your application or you can use the command “php artisan serve” PHP's built-in development server. Sometimes less is better

As mentioned before Laravel comes with lots of resources, but what if you don’t need all of them? What if you just want to develop an API or you want to build something small and Laravel seems overwhelming?

For scenarios like this, Laravel has a micro version called Lumen with only the essential features you will need to develop APIs and Web services. The steps to install Lumen are the same as those for Laravel, you just have to replace some names as you can see in the commands below.

composer global require "laravel/lumen-installer"

Starting project with Lumen:

lumen new YOUR_PROJECT_NAME

Starting project with Composer:

composer create-project --prefer-dist laravel/lumen YOUR_PROJECT_NAME

Besides these small changes, the rest of the installation process and tools will be the same. You will only need three PHP extensions this time.

OpenSSL PHP Extension
PDO PHP Extension
Mbstring PHP Extension

More features

Laravel provides a basic start for front-end to quickly begin developing with Bootstrap and React or Vue. For this, you have to first install the laravel/ui package with Composer. See the steps below:

composer require laravel/ui

Once the ui package is installed, you can proceed to install the front-end packages.

Basic installation:

php artisan ui bootstrap
php artisan ui vue
php artisan ui react

Installation with authentication system:

php artisan ui bootstrap --auth
php artisan ui vue --auth
php artisan ui react --auth

*This doesn’t mean that you can only use these three options. You can also use Angular or any other front-end framework with Laravel; these are just suggestions that Laravel brings ready to go.

Conclusion

Laravel is a very powerful and popular framework, it can be used for small and big projects and has all the features you will need and many more services to offer. The Laravel ecosystem also offers lots of tools like Nova (an admin panel), Telescope (a debug assistant), Echo (to handle real-time events), and many other tools to take you even further. The framework’s documentation is very straightforward and simple to understand, and the community around it is very active and helpful.

About the Author

Ricardo Aranha

I am a software engineer passionate about technology, always challenging myself to evolve and achieve my goals. I am always interested in learning new things and sharing my knowledge with my colleagues and friends.

– – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –

Leave a Reply

Your email address will not be published.


×

Hello!

Click below to speak to one of our team members.

× How can we help?