This guide is aimed at the PHP/Laravel developer who would like to create and launch a new project running on Divio's Docker-based Cloud.

The guide assumes that you are already familiar with PHP/Laravel and key developer tools such as Git.

Important: The Laravel project type is offered as a public beta. We welcome feedback from users to help us improve it.

Before we begin

If you are not already familiar with the Divio Cloud infrastructure, Control Panel and local development environment, please make use of some key topics and resources:

Create a new Laravel project

In the Control Panel, create a new project with the following configuration:

  • Platform: PHP
  • Type: Laravel
  • Boilerplate: Default

Set up the project locally

Run Setup to clone and build

Select the project and hit Setup in the Divio app

or use the Divio CLI:

divio project setup <project slug>

 to set the project up locally. This will take a few minutes to:

  • clone the project's Git repository
  • execute the commands in its Dockerfile  to build the project image

Complete the installation

In a shell, cd into the project directory.


docker-compose run --rm web php /app/divio/setup.php

This will:

  • create any required directories
  • set permissions correctly for development
  • run composer install  to install all requirements and run database migrations

Note: you may see some errors related to the Postgres database if you have not previously deployed the project on the Cloud - these may be safely ignored, as long as the process completes successfully. 

Launch the server

 Once completed:

  • hit Start (Divio app), or, 
  • run docker-compose up (Divio CLI) 

to launch the local server.

Now you can open your local website using the "eye" icon on the top right of the Local Server in the Divio App, or open in a browser. 

Interacting with the local project

Your project runs in a Docker container. While the web container is already running you can execute commands in it using docker-compose exec web <command> . For example to launch a bash shell:

docker-compose exec web bash

You can also use docker-compose run --rm web <command> to launch a container and run a command in it:

docker-compose run --rm web bin/console doctrine:migrations:migrate
docker-compose run --rm web composer install

Next steps

You can push code (using Git) and database and media (using the Divio tools) to the Divio Cloud platform and deploy your project on a Cloud server.

Our Developer Handbook is the recommended source for further information about using the platform as a developer.  

About your Divio Laravel project

The container running your application contains a plain Laravel installation, similar to what would be installed via composer

We have added a few scripts that ease interaction with Divio Cloud. They are either located in the root directory or the divio folder.

The  league/flysystem-aws-s3-v3 package is installed, to provide support for Laravel's native storage engine.

Environment variables would typically be stored in a file named .env

Our set-up uses native environment variables, and prefers these over those in the .env file. 

In production, all credentials needed by your application will be provided by environment variables. Those that are required in order to run the project are provided by default. Additional environment variables can be added via the Divio Cloud web interface.

For local development you can set the environment variables in divio/.env-local .

Did this answer your question?