Skip to main content

Laravel

Laravel is a free, open-source PHP web framework intended for the development of web applications. It follows the Model-View-Controller (MVC) architectural pattern and is known for its elegant syntax. Laravel provides features for tasks such as routing, authentication, sessions, caching, and unit testing. It encompasses tools for accessing relational databases and a robust ecosystem that enables easy deployment and hosting.

Laravel versions

The template now support the following versions of Laravel: >=10

May works with other versions, but not tested.

Laravel installation

To use this template, you need to install Laravel first. You can do it by following the official documentation

With composer

dcmd toolbox start # in your project root folder
composer create-project laravel/laravel .

Get the template

At root of your project (where the public folder is located), run the following command:

dcmd template get laravel

Configure the template

  • Create and configure the environnement file by copying the .env.example file to .env
  • Set the name of your project in the docker-compose.yml file
  • Set the right name for your virtual host in .docker/etc/apache/httpd-vhosts.conf

More information here : project configuration

Initialize the project

At root of your project (where the public folder is located), run the following command:

dcmd up

Setup the environment

Setup Laravel environment files, and your settings for the right database credentials and other settings.

Edit the generated .env file and set the DATABASE_URL variable to mysql://user:user@db:3306/default (if you're using the default database configuration)

Default database credentials

Informationdefault value
hostdb
port3306
namedefault
usernameuser
passworduser
dcmd artisan
Website URL

You're good to go! You can now access your project at : http://${PROJECT_NAME}.dev.local Or with artisan serve --host 0.0.0.0: http://localhost:8000