The Sulu workshop consists of 12 assignments that guide you through the process of creating a small website that integrates two simple custom entities using the Sulu content management system. This repository contains the example project, assignments and solution code for the workshop. The included example project builds upon the official sulu/skeleton template and adds some implementation-specific libraries such as Bootstrap or Symfony Encore.
The assignments of the workshop are available via the pull requests area of this repository. Each pull requests contains the example solution code for the respective assignment. Feel free to use the comment feature on these pull requests for asking questions or providing additional context about the solution code.
- PHP 8.1 or higher
- Relational Database like MySQL, MariaDB or PostgreSQL
If you choose to run your services with docker you can startup your database by executing the following command:
docker-compose up
If you prefer to use your local database you can configure your credentials in a .env.local
file in the root directory of the project:
DATABASE_URL=mysql://DB_USER:DB_PASSWORD@127.0.0.1:3306/DB_NAME
Use composer to install the dependencies of the project:
composer install
Run the following command to initialize the database that will be used by Sulu:
bin/console sulu:build dev --destroy
You can startup the built-in PHP web-server with:
php -S localhost:8009 -t public config/router.php
If you have the SYMFONY CLI Tools installed and want to increase your performace you can also use the following command to startup the SYMFONY webserver:
symfony server:start
The project setup in the repository includes several development tools that help you to improve the quality of your code
The project already contains some unit tests and functional tests. They can be executed with the following commands:
# create and update test database
composer bootstrap-test-environment
# execute all test cases
composer test
You can can pass additional phpunit arguments by appending -- <arguments>
to the composer test
command.
composer test -- --stop-on-fail
To keep your code consistent you can automatically reformat your code with the following command:
composer fix
PHPStan helps you to catch bugs before they actually occur by statically analyzing your code. Use following command to run it:
composer phpstan