Hello, friends. In this post, you will learn how to install Laravel on Debian 11. This powerful PHP framework is one of the most popular and innovative ones out there, that’s why you should know how to install it and get it ready for the start of your project.
What is Laravel?
Laravel is one of the easiest open-source frameworks for PHP to assimilate. One of its advantages is that it has a much easier learning curve than other web and application development tools. It was created in 2011 and is heavily influenced by frameworks such as Ruby on Rails, Sinatra, and ASP.NET MVC.
With Laravel, we will have available other tools that together make up the power of Laravel.
- Blade: A powerful template manager where we can manage PHP variables directly in the view.
- Eloquent: Laravel’s database system, for writing and retrieving data. So we don’t have to work directly with SQL code.
- Routing: LAravel has its own routing system that helps us to set up the routing of our pages with GET or POST methods.
Besides this, Laravel is one of the best-documented frameworks that exist and with an active community willing to give support to the newbie.
So, let’s get started.
Install Laravel on Debian 11
Installing the Laravel requisites
First, you need to install PHP and some of its modules and the
sudo apt install php php-bcmath php-json php-mbstring php-pdo php-tokenizer php-xml php-pear php-zip php-zip unzip
Install PHP Composer on Debian 11
The installation of laravel can be done without problems using PHP Composer. So we have to install it and keep it up to date.
For that, we invite you to read our post about it:
Once it is installed and updated, we can follow the procedures.
Install Laravel on Debian 11
Now with the help of Composer, we have to install Laravel. To do this, run the following command
composer create-project --prefer-dist laravel/laravel [project_name]
Where the last value is where you have to specify the name of your project.
So, Composer will start with downloading and installing all Laravel dependencies. When finished, you will see an output screen like this
This will create a folder with the name of your project that we need to access.
And there will be all our Laravel working and ready for us to start creating code.
If you want to check how the project is running and also if you want to verify the installation, you can run
php artisan serve
Then open a web browser and go to
http://localhost:8000 and you’ll see an image like this
In case Laravel has been installed on a server or another computer over the network, you can specify that it is accessible from another computer.
php artisan serve --host=0.0.0.0.0 --port=1234
This way you can access the computer and with the
1234 port you can change these values to your liking.
During this post, you have learned how to install laravel on Debian 11 so you can start developing cool applications that you can take to production. So, this is a powerful framework that you need to take full advantage of.