Laravel

Laravel is a web application framework with expressive, elegant syntax. We’ve already laid the foundation β€” freeing you to create without sweating the small things.


Note

For this guide you should be familiar with the basic concepts of

License

All relevant legal information can be found here

Prerequisites

We’re using PHP version 8.5:

[isabell@stardust ~]$ uberspace tools version show php
Using 'PHP' version: '8.5'
[isabell@stardust ~]$

Your web domain needs to be set up:

[isabell@stardust ~]$ uberspace web domain list
isabell.uber.space
[isabell@stardust ~]$

Installation

cd to your user dir, then install the Laravel installer via Composer. Finally, create a new project using the installer and choose your starter kit <https://laravel.com/docs/13.x/starter-kits>.

[isabell@stardust ~]$ cd /var/www/virtual/$USER/
[isabell@stardust isabell]$ composer global require "laravel/installer"
[isabell@stardust isabell]$ laravel new my_project

Use the arrow keys to select your desired starter kit. In this example, we’ll proceed without a starter kit. Confirm with Enter.

β”Œ Which starter kit would you like to install? ────────────────┐
β”‚ None                                                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Next, choose your testing framework. We’ll use Pest and confirm with Enter.

β”Œ Which testing framework do you prefer? ──────────────────────┐
β”‚ Pest                                                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Now you’ll be asked about Laravel Boost, which we don’t need for this guide. Select β€œNo” and confirm with Enter.

β”Œ Do you want to install Laravel Boost to improve AI assisted coding? ┐
β”‚ No                                                                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Next, select your database. We’re using MySQL, so select that option. Since we haven’t configured the MySQL credentials yet, select β€œNo” when asked to run the default database migrations.

β”Œ Which database will your application use? ───────────────────┐
β”‚ MySQL                                                        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œ Default database updated. Would you like to run the default database migrations? ┐
β”‚ No                                                                               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

The installer will now create all files for you. Finally, you’ll be asked whether to run npm install --ignore-scripts and npm run build. Select β€œNo” and confirm. We’ll run these commands later after configuring the database.

 Application ready in [my_project]. You can start your local development using:

➜ cd my_project
➜ npm install --ignore-scripts && npm run build
➜ composer run dev

New to Laravel? Check out our documentation. Build something amazing!
[isabell@stardust isabell]$

Change the DocumentRoot

After the installation has finished, remove your unused DocumentRoot and create a new symbolic link to the my_project/public directory.

[isabell@stardust ~]$ cd /var/www/virtual/$USER/
[isabell@stardust isabell]$ rm -f html/nocontent.html; rmdir html
[isabell@stardust isabell]$ ln -s /var/www/virtual/$USER/my_project/public html
[isabell@stardust isabell]$

Configuration

Set up the database

First figure out your SQL Credentials that uberspace has created for you.

You’ll need your MySQL credentials. Get them with my_print_defaults:

[isabell@stardust ~]$ my_print_defaults client
--default-character-set=utf8mb4
--user=isabell
--password=MySuperSecretPassword
[isabell@stardust ~]$

You’ll need to add this information to the .env file located in the project root directory.

Update the following lines:

APP_NAME=LARAVEL

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=isabell
DB_USERNAME=isabell
DB_PASSWORD=MySuperSecretPassword

Create database tables and build assets

The database is still empty. Create the tables defined in the migrations and build the frontend assets:

[isabell@stardust ~]$ cd /var/www/virtual/$USER/my_project
[isabell@stardust my_project]$ php artisan migrate
[isabell@stardust my_project]$ npm install --ignore-scripts && npm run build

When you open your domain, you should now see the Laravel welcome page and are ready to start development.


Tested with Laravel 13, Uberspace 7.17.3, and PHP 8.5

Written by: Felix Wienss <https://github.com/FelixWienss>