This is a template for a Silverstripe 5 project. It includes a basic setup for a Silverstripe 5 project with a docker setup.
- Docker
- Docker-compose
- Composer
- PHP
Start by creating a new GitHub repository using this template.
- Clone the repository
- Make sure you create a .env based on the .env.example. Fill out the necessary information.
- Run
composer install
- Run
docker-compose up -d
- Now you should be able to reach the web project at "http://localhost".
For existing projects, simply copy the docker-compose.yml into the root of your project. Assuming you have a .env file, you can simply run docker-compose up -d
to start the project.
After running docker-compose up -d
you should have the following services running:
The web service is running the PHP server. You can reach the web server at "http://localhost".
The database service is running a MySQL server. You can reach the database server at "localhost:3306".
Default credentials:
- Username: root
- Password: root
- Database: silverstripe
The PHPMyAdmin service is running a PHPMyAdmin server. You can reach the PHPMyAdmin server at "http://localhost:8081".
The Mailpit service is running a MailPit server. You can send mails through the mailing server, which is reachable at 'localhost:1025'. Every mail sent using this server will be caught (so it won't be sent to any real email). To see the mails, you can reach the web interface at 'http://localhost:8025'
- Go to File > Settings (on Windows/Linux) or PhpStorm > Preferences (on macOS).
- Navigate to Languages & Frameworks > PHP.
- Click the ... button next to the CLI Interpreter field.
- Click the + button to add a new interpreter.
- Select From Docker, Vagrant, VM, Remote....
- Choose Docker Compose.
- Select your Docker Compose configuration file and the service (e.g., web).
- Click OK.
- Go to Languages & Frameworks > PHP > Servers.
- Click the + button to add a new server.
- Name: docker-web (or any name you prefer).
- Host: localhost.
- Port: 80.
- Use path mappings to map your local project path to the path inside the container (/var/www/html).
- Click OK.
- Go to Run > Edit Configurations.
- Click the + button and select PHP Remote Debug.
- Name your configuration, for example, XDebug Docker.
- In the Servers dropdown, select the server you configured (docker-web).
- Set the IDE key to 'docker'.
- Click OK.
- By clicking on debug you can now start debugging.