api-platform-upgrade
Skill2 starsChanged 6 months agoMITView on GitHub
Migrate an API Platform codebase from 3.x or 4.0–4.2 up to 4.3. Trigger when composer.lock shows api-platform/* < 4.3, when grep finds #[ApiFilter] / openapiContext / hydra:* / ApiPlatform\\Core\\ / AbstractFilter / SerializerAwareProviderInterface / SerializableProvider / event_listeners_backward_compatibility_layer in src/, or when 4.x default flips need attention (hydra_prefix:false, standard_put:true, rfc_7807_compliant_errors:true, pagination_items_per_page:30, eager_loading.force_eager:true). Covers the lyrixx/rector-apip-openapi Rector script + the 4.3-specific breaks (mandatory `property` on Exact/Iri/Partial/Uuid filters; readonly entities no longer auto-expose PUT/PATCH). This is the dedicated migration playbook — every other skill in this plugin targets 4.3 exclusively.
In this repository52 other files it gives its agents.
- api-platform-dto-resourcesSkill
- api-platform-errorsSkill
- api-platform-file-uploadSkill
- api-platform-filtersSkill
- api-platform-identifiersSkill
- api-platform-mcpSkill
- api-platform-mutatorsSkill
- api-platform-openapiSkill
- api-platform-paginationSkill
- api-platform-performanceSkill
- api-platform-resilienceSkill
- api-platform-resourcesSkill
- api-platform-securitySkill
- api-platform-serializationSkill
- api-platform-state-processorsSkill
- api-platform-state-providersSkill
- api-platform-testsSkill
- api-platform-userSkill
- api-platform-versioningSkill
- bootstrap-checkSkill
- brainstormingSkill
- config-env-parametersSkill
- controller-cleanupSkill
- cqrs-and-handlersSkill
- daily-workflowSkill
- doctrine-batch-processingSkill
- doctrine-fetch-modesSkill
- doctrine-fixtures-foundrySkill
- doctrine-migrationsSkill
- doctrine-relationsSkill
- doctrine-transactionsSkill
- effective-contextSkill
- executing-plansSkill
- functional-testsSkill
- interfaces-and-autowiringSkill
- makefile-disciplineSkill
- messenger-retry-failuresSkill
- ports-and-adaptersSkill
- quality-checksSkill
- rate-limitingSkill
- runner-selectionSkill
- strategy-patternSkill
- symfony-cacheSkill
- symfony-messengerSkill
- symfony-schedulerSkill
- symfony-votersSkill
- tdd-with-pestSkill
- tdd-with-phpunitSkill
- test-doubles-mockingSkill
- using-symfony-superpowersSkill
- value-objects-and-dtosSkill
- writing-plansSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 26
Run the Rector script for openapiContext and inspect for any remaining legacy references.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
API Platform — Upgrade Guide (3.x → 4.x → v5 prep)
Use when
- A
composer.lockanalysis (session hook) shows API Platform < 4.3. - Reviewing or migrating code that still imports
ApiPlatform\Core\, uses#[ApiFilter],openapiContext, or implementsSerializerAwareProviderInterface/SerializableProvider. - Bulk-renaming filters from the legacy classes to the modern 4.3 equivalents.
- Planning the v5 cut-over (preventing regressions via PHPStan / Deptrac).
Default workflow
- Determine the starting version from
composer.lock. Hard-stop on 3.x without explicit planning. - Apply the 3.x → 4.0 macro-changes (namespaces, package split, Providers/Processors, defaults).
- Apply the 4.0 → 4.2 changes (modern filter pattern using
parameters: [QueryParameter]). - Apply the 4.2 → 4.3 breaks (explicit
propertyon Exact/Iri/Partial/Uuid filters; review readonly entities; check@typeconsumers). - Run the Rector script for
openapiContextand inspect for any remaining legacy references. - Enable v5-prep guards (PHPStan rule, Deptrac layer) to prevent regressions.
Guardrails
- Do not migrate without a passing test suite. Re-baseline tests if they assert
hydra:member(replace bymember). - Default flips in 4.x can break consumers:
hydra_prefix:false,standard_put:true,rfc_7807_compliant_errors:true,pagination_items_per_page:30. Audit clients before flipping. eager_loading.force_eager: trueis the 4.x default but often counter-productive — set it tofalseand use targeted join fetches.- Only this skill is allowed to mention
#[ApiFilter],openapiContext,hydra:member,extends AbstractFilter, etc. The lint script rejects them elsewhere.
Progressive disclosure
SKILL.mdsummarizes the migration path.reference.mdcarries the full tables: 3.x → 4.0 macro changes, 4.0 → 4.2 filter shift, 4.2 → 4.3 breaks, behavioral changes (isGranted pre-provider, Hydra#ShortName, LDP headers), 4.3 novelties, removed-in-v5 list, full legacy → modern mapping, tooling (Rector, PHPStan rule, Deptrac),composer outdatedaudit.
Output contract
- A migration plan in three steps (3.x → 4.0 → 4.2 → 4.3).
- All
#[ApiFilter]annotations replaced byparameters: [QueryParameter]. - All
openapiContext: […]replaced byopenapi: new Model\Operation(…). - All
hydra:member/hydra:totalItemsreferences replaced in tests. - No
ApiPlatform\Core\imports remaining. SerializerAwareProviderInterface/SerializableProviderimplementations deleted.
References
reference.md- Upstream upgrade guide: https://api-platform.com/docs/core/upgrade-guide/
- Rector script: https://github.com/lyrixx/rector-apip-openapi
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

