api-platform/installer
Composer installer for API Platform, the PHP framework for building REST and GraphQL APIs. It streamlines project creation and setup, delivering a ready-to-use application with sensible defaults and minimal configuration for your next API.
api-platform/installer is not a library you require in an application — it is the Composer plugin that bootstraps a new API Platform project. You interact with it almost exclusively through composer create-project.
Prerequisites: PHP 8.2+, Composer 2.x, and (for the default skeleton) Docker or a local PHP server.
Minimal steps:
composer create-project api-platform/api-platform my-api
cd my-api
docker compose up -d # or: symfony serve / php -S localhost:8000 -t public
Then open https://localhost/docs for the Swagger UI and https://localhost/api for the entrypoint. The installer has already written .env (APP_SECRET, DATABASE_URL), wired the Docker services, and installed api-platform/core.
Where to look first:
composer.json → extra.class / type of the plugin, and the scripts block (post-create-project-cmd).vendor/api-platform/installer/ in the generated project (read the plugin class to see exactly which files it touches)..env, compose.yaml, and config/packages/api_platform.yaml — these are the artifacts the installer produces that you will actually edit day-to-day.First real use case: scaffolding a throwaway project to inspect the current “blessed” layout before upgrading your own app, or generating a reproducible starter for a team.
composer create-project api-platform/api-platform my-api "^4.0" to pin a major version. Never run composer require api-platform/installer in an existing app; it does nothing useful outside the create-project lifecycle.composer config --global allow-plugins.api-platform/installer true
COMPOSER_NO_INTERACTION=1 composer create-project api-platform/api-platform my-api --no-scripts=false
Commit the resulting composer.json and composer.lock, not vendor/.src/Entity/src/State examples, commit as an internal template repo, and let teammates clone instead of re-running the installer. This sidesteps installer churn between minor versions.composer require api-platform/core plus the Flex recipe, then hand-write config/packages/api_platform.yaml and the routes. The installer assumes a clean directory.composer create-project api-platform/api-platform my-api --no-install to fetch the skeleton without executing the plugin, then diff its output against a fully installed project to see what the installer contributes.type: composer-plugin + extra.class contract and subscribe to post-create-project-cmd; that is the only extension point the upstream plugin exposes.composer-plugin-api ^2.0; Composer 1 silently skips it and you get a half-configured project.create-project may ask to allow the plugin. In non-interactive shells that prompt defaults to “no” and the post-install customization is skipped. Pre-seed allow-plugins globally or pass --no-interaction only after configuring it.api-platform/core with composer update — do not re-run create-project over your code.APP_SECRET or missing DB env. Delete the directory and retry rather than patching by hand.composer create-project -vvv api-platform/api-platform my-api and COMPOSER_DEBUG_EVENTS=1 show plugin/event dispatch. Read vendor/api-platform/installer/src/ to confirm exactly which files it rewrites.APP_SECRET and DB. First boot fails cryptically (bin/console errors, 500s on /api) if .env was not populated. Confirm APP_SECRET and DATABASE_URL before blaming the framework.compose.yaml expects specific ports and a PostgreSQL service; on a machine with an existing Postgres on 5432 you must remap.How can I help you explore Laravel packages today?