-1 C
Texas
angeloma
Senior Writer and partner

How to install Laravel on Ubuntu 20.04?

As PHP is one of the most successful and popular programming languages out there, it is logical to find many different frameworks. Some of them are more simple than others and among them stands out the one that for many is the framework of the readable code. So, in this post, you will learn how to install Laravel on Ubuntu 20.04

The team responsible for the development and maintenance of Laravel defines it as the PHP framework for artisans. This is because Laravel respects the clear and legible syntax of the code. In addition to this, it has a huge user community that is constantly checking the source code for errors.

Laravel has grown so much that there is a whole ecosystem of applications and tools to continue taking advantage of the framework. So we are talking about a community PHP framework that behaves professionally.

In the same way, some distinctive elements of Laravel are Blade for creating the templates, Eloquent for integrating the database correctly, and Artisan as a command interpreter.

Laravel Prerequisites

- Advertisement -

Laravel is a PHP framework, so it is obvious that it has to be installed. But not only that, but it also requires certain modules for the execution to be complete.

These modules have to be present on your computer if you want Laravel to install correctly:

  • BCMath PHP Extension
  • Ctype PHP Extension
  • JSON PHP Extension
  • Mbstring PHP Extension
  • OpenSSL PHP Extension
  • PDO PHP Extension
  • Tokenizer PHP Extension
  • XML PHP Extension

So, let us start.

Install Laravel on Ubuntu 20.04

Getting Composer on Ubuntu 20.04

The safest and most recommended method to install Laravel is to use the PHP dependency manager, Composer.

So, to install it you can read our post:

How to install PHP Composer on Ubuntu 20.04?

And if you want more information about how to use it, you can also read:

Using Composer on Linux

When Composer is ready and configured, you can continue.

Installing Laravel on Ubuntu 20.04

Now it’s time to install Laravel. To do this, we will use Composer.

So, run the following command on a terminal:

:~$ composer create-project --prefer-dist laravel/laravel example
1.- Installing Laravel on Ubuntu 20.04
1.- Installing Laravel on Ubuntu 20.04

You can change the word example to the name of your project.

Once you have typed the Composer command it will do the job. It will check each of Laravel’s dependencies and start downloading it. As well as its directory structure.

You can open the folder with your favorite text editor and start working.

To check that everything is right, you can serve the project. If you have installed Laravel on a local computer, run it:

:~$ cd example
:~$ php artisan serve
2.- Serve the Laravel Project
2.- Serve the Laravel Project

Remember that instead of example you have to put the name of your project. This will make your project available at http://localhost:8000

However, if you have installed Laravel on another computer remotely, such as on a LAN, you can specify a host and port specifically.

:~$ php artisan serve --host=192.168.250.20 --port=1234
3.- Serve the Laravel project with one specific host and port
3.- Serve the Laravel project with one specific host and port

I have chosen these values for this post, you can change them with confidence. Also, the chosen port has to be available in the Firewall.

In any case, when you open your browser and go to where the Laravel project is being served, you will see the following:

4.- Laravel working
4.- Laravel working

This indicates that you are ready to start developing.

Conclusion

Laravel is a fairly popular PHP framework with which you can create many fantastic web applications but you have to start by knowing how to install it.

Please share this post and join our Telegram channel.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article