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 infrastructure, Control Panel and local development environment, please make use of some key topics and resources:
- General overview of the Control Panel More information about your account, project settings and more.
- How to create a new Divio project Additional detail about project creation options.
- Our Developer Handbook.
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
Dockerfileto 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
- create any required directories
- set permissions correctly for development
composer installto 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
- hit Start (Divio app), or,
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
You can push code (using Git) and database and media (using the Divio tools) to the Divio 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.