Symfony
Symfony is a set of reusable PHP components and a PHP framework for web projects. It provides a structure around which developers can build a wide variety of applications, from simple websites to complex web applications. Symfony is known for its speed, flexibility, reusable components, and its ability to integrate with other vendor libraries.
Symfony versions
The template now support the following versions of Symfony: >=6.2
May works with other versions, but not tested.
Symfony installation
To use this template, you need to install Symfony first. You can do it by following the official documentation
With composer
dcmd toolbox start # in your project root folder
composer create-project symfony/skeleton .
Get the template
At root of your project (where the public
folder is located), run the following command:
dcmd template get symfony
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
To use symfony as a webapp:
dcmd composer require webapp
dcmd composer require symfony/apache-pack
Setup the environment
Setup Symfony 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
Information | default value |
---|---|
host | db |
port | 3306 |
name | default |
username | user |
password | user |
You're good to go! You can now access your project at :
http://${PROJECT_NAME}.dev.local
Installing Symfony console CLI (optional)
To install it, run the following command:
dcmd composer require symfony/console
Then you can run the Symfony console:
dcmd console [args]