Installing API Platform
Installing API Platform
~13 Min. Lesezeit Zuletzt aktualisiert am August 8, 2026
Unlike the Symfony course's webapp skeleton, we're using the OFFICIAL api-platform/api-platform distribution here – an ALREADY fully pre-configured setup including Docker, a database, and Mercure.
Checking prerequisites
This distribution requires Docker AND Docker Compose (NO locally installed PHP needed, unlike the Symfony course) – EVERYTHING runs in containers:
docker --version
docker compose versionCreating the project
composer create-project api-platform/api-platform aufgaben-manager-api
cd aufgaben-manager-apiThis command downloads the COMPLETE distribution – including a pre-configured compose.yaml that already CONTAINS several services: the PHP/Symfony container (with Caddy as the web server), PostgreSQL, AND a Mercure hub (chapters 67-72).
Starting the containers
docker compose up -d --wait--wait waits until ALL containers are actually "healthy" before the command returns – useful for making sure the database is READY before running migrations in the next step.
docker compose psShows ALL running containers with their status – expect at least a php container (with Caddy), a database container, and a mercure container.
Testing the first call
curl -k https://localhost/apiCaddy AUTOMATICALLY sets up a local, self-signed HTTPS certificate – EXACTLY like the Symfony CLI in the Symfony course, only THIS TIME entirely inside the Docker containers instead of installed locally.
Running bin/console inside the container
docker compose exec php bin/console aboutEXACTLY the same bin/console command from the Symfony course – the difference: it now runs INSIDE the php container, docker compose exec php before it is Docker's typical way to run a command in a running container.
Tipp: An alias saves repeated typing: alias dc-console='docker compose exec php bin/console' – then dc-console about is enough. This course still spells out the full command for clarity.
Installing Composer packages
docker compose exec php composer require --dev symfony/maker-bundleEXACTLY the same principle – composer runs INSIDE the container, so the installed PHP extensions and PHP version are GUARANTEED to match the runtime environment, regardless of which PHP version (if any) is installed locally on your machine.