This guide is aimed at the PHP/Symfony 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/Symfony and key developer tools such as Git.

Important: The Symfony 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 Symfony project

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

  • Platform: PHP
  • Type: Symfony
  • 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.

Run:

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 http://127.0.0.1:8000 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.  

Did this answer your question?