Skip to content

Creating the Laravel Sail app

Clio Brichaut edited this page Jan 14, 2023 · 1 revision
  1. Get the prerequisites (Windows): Docker Desktop, Ubuntu 20.04.

  2. Create the new LaravelAPI repository on GitHub, then clone it locally.

Use the Ubuntu/WSL terminal for the next commands.

  1. Move into the repo with cd /mnt/c/.../LaravelAPI.

  2. Install Laravel with sudo curl -s "https://laravel.build/app?with=mysql" | bash.

  3. Move into the project with cd app.

  4. Launch the containers with ./vendor/bin/sail up -d.

  5. Open http://localhost/. You can now see the Laravel app running on PHP 8.1, its built-in server, and MySQL 8.

  6. Add a phpMyAdmin service in /app/docker-compose.yml:

  phpmyadmin:
   image: 'phpmyadmin:latest'
   ports:
     - 8080:80
   networks:
     - sail
   environment:
     PMA_HOST: '${DB_CONNECTION}'
     PMA_PORT: '${DB_PORT}'
     PMA_USER: '${DB_USERNAME}'
     PMA_PASSWORD: '${DB_PASSWORD}'
  1. Run ./vendor/bin/sail up -d again.

  2. Open http://localhost:8080/. You can now access the database in the browser.

Clone this wiki locally