Why Laravel?
Why you should install Laravel on the Raspberry Pi 4? There are several reasons for this. With Laravel you can develop professional web applications. The free PHP framework Laravel is very well suited for object-oriented programming according to the MVC architecture. Thus, you achieve a low-maintenance code. If you are a PHP programmer, you will have an easier time than with a Java framework. By adhering to naming conventions, you save programming code. This way you can design a connection to a database with little code. Another point is the separate structure of HTML areas. This way you create a consistent look of your pages.

Table of Contents
- Why Laravel?
- Why Raspberry Pi 4?
- Installing the software components for Laravel on Raspberry Pi 4
- Step 1: Update package sources, upgrade software
- Step 2: Install Apache and PHP
- Step 3: Install MariaDB as database and security settings
- Step 4: Set user access to database
- Step 5: Install database software “phpmyadmin
- Step 7: Add missing packages
- Step 8: Create a project with Laravel on Raspberry Pi 4
- Step 9: Test the executability of your PHP framework Laravel
- Install great additional packages
- Why include Bootstrap?
- Why include the “Vue.js” framework?
Why Raspberry Pi 4?
The main argument is the use of a low-cost development environment. The Raspberry Pi 4 scores with:
- Very low power consumption;
- Good performance;
- Resource-saving operating system Raspberry Pi OS;
Furthermore, we recommend a working memory of at least 4 GB. The variant with 8 GB of working memory is even better.
In addition, you can work on the surface of the Raspberry Pi. To do this, use remote access. In Windows 10, you can use Remote Desktop for this. In addition, multiple users can work on the Raspberry in the network. To do this, you first set up the users.
Installing the software components for Laravel on Raspberry Pi 4
Now we will show you how to set up the PHP framework Laravel. For this we use the Raspberry Pi OS operating system. This used to have the name Raspbian.
Step 1: Update package sources, upgrade software
Before installing, you should update the package sources and upgrade the packages.
sudo apt-get update
sudo apt upgrade
Step 2: Install Apache and PHP
The packages for Apache and PHP serve as the basis for the PHP framework Laravel. Install them now.
sudo apt-get install apache2
sudo apt-get install php
Step 3: Install MariaDB as database and security settings
First, install the packages for the database. After that, you can go through the security settings. If you confirm the prompts with yes, the MariaDB security standard will be activated.
sudo apt-get install mariadb-client
sudo apt install mariadb-server
sudo mysql_secure_installation
Step 4: Set user access to database
In this step you define the user for the database. You also set read and write permissions for all tables. Instead of the user “pi” we recommend another user name. Use a secure password of your own instead of YOURPASSWORD. With the command “sudo mysql” you get into the console of MariaDB.
sudo mysql
CREATE USER 'pi'@'localhost' IDENTIFIED BY 'YOURPASSWORD';
GRANT ALL PRIVILEGES ON *. * TO 'pi'@'localhost';
Step 5: Install database software “phpmyadmin
Finally, install the software “phpmyadmin”. Although there are still a few adjustments to avoid error messages in the program. However, this does not matter for the time being, as we only use the program to keep track of created tables and data.
sudo apt install phpmyadmin
Step 6: Download, install and update Composer
Composer is a package manager for PHP applications. First, download the Composer Installer. After that, install Composer. Finally, check the version. Then remove the installation file. In the last step, you request the update of Composer.
wget -O composer-setup.php https://getcomposer.org/installer
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
composer --version
sudo rm -rf composer-setup.php
sudo composer self-update
Step 7: Add missing packages
After installing Composer, add necessary packages. These are among others phpunit and php-xml.
sudo apt-get install phpunit
sudo apt install php-xml
Step 8: Create a project with Laravel on Raspberry Pi 4
Now create your first Laravel project. To do this, use Composer. Use the cd command to change to the project folder.
composer create-project laravel/laravel YOURPROJECTNAME
cd YOURPROJECTNAME
Step 9: Test the executability of your PHP framework Laravel
After that, test if Laravel works on Raspberry Pi 4. You should be in the console and in the project folder.
php artisan serve
Open a browser on the Raspberry Pi OS interface. Then call the address “localhost:8000”. Here appears the demo page of Laravel. If you see this, you have successfully installed the Laravel framework. You can also install Visual Studio Code, Bootstrap and “Vue.js”. You can see how you do that now.
Install great additional packages
In the next section we will show you how to install useful additional packages.
- Visual Studio Code
- Bootstrap
- Vue.js
Step 10: Install Visual Studio Code
To edit source code and folders we use Visual Studio Code. You can install it as follows.
sudo apt install code
Why include Bootstrap?
Bootstrap is a free frontend CSS framework. This can be very well integrated into the PHP framework Laravel. It contains design templates which are based on HTML and CSS. For example, for:
We are testing the use of Boostrap to give our software product a nice look in the end. After all, the wheel doesn’t always have to be reinvented.
Step 11: Install Laravel/ui and Bootstrap
After that we install the Laravel User Interface and Bootstrap. We also use Bootstrap for the login mask. That’s why we append –auth to the command.
composer require laravel/ui
php artisan ui bootstrap --auth
Why include the “Vue.js” framework?
We tell you why you should integrate the popular Javascript web framework “Vue.js”. On the one hand, this framework can be classified as progressive and performant. In addition, the use of a Javascript framework simplifies the maintenance and testing of functions. Experience shows that getting started with the framework is easier than with Angular or React. Through our research, we found that it can be set up on our test environment as well. Furthermore, the use of the PHP framework Laravel is supported.
- Forms
- Typography
- Buttons
- Tables
- Grid systems
Step 12: Install Node.js and vue.js
Then we download the appropriate “Node.js” version. In our case it’s version 14, then you install packages and dependencies to “Node.js”.
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
npm install && npm run dev
npm run dev
php artisan ui vue
npm install && npm run dev
npm run dev
We did it!
You have managed to prepare your framework. You could also install add-on packages. With it you can tackle your programming tasks with Laravel, the framework “Vue.js” and Bootstrap. You can use for example the Quelleditor Visual Studio Code.