api-platform-resources
Installation
SKILL.md
Api Platform Resources (Symfony)
Use when
- Exposing a new entity or class as an
#[ApiResource]. - Choosing exactly which of
Get,GetCollection,Post,Put,Patch, andDeletethe API offers. - Tuning collection pagination (items per page, partial pagination, client control).
- Documenting operations with typed OpenAPI objects instead of
openapiContextarrays.
Default workflow
- Install only the components you need:
api-platform/symfony,api-platform/doctrine-orm, and optionallyapi-platform/graphql; on Symfony 6.4 LTS, pin them to~4.3.0. - List every operation in
operations:, since declaring any one stops the automatic CRUD, andPutis never automatic. - Set
uriTemplate,requirements,status, orroutePrefixonly where the defaults do not fit. - Configure pagination through resource attributes or
api_platform.defaultsinconfig/packages/api_platform.yaml. - Describe operations with
openapi:model objects, setvalidationContextgroups, then check the routes and the OpenAPI export.