Skip to content

API Platform: Add support for resource attributes, filters and operation targets#346

Draft
janedbal wants to merge 1 commit intomasterfrom
api-platform-support
Draft

API Platform: Add support for resource attributes, filters and operation targets#346
janedbal wants to merge 1 commit intomasterfrom
api-platform-support

Conversation

@janedbal
Copy link
Copy Markdown
Member

@janedbal janedbal commented Apr 20, 2026

Summary

  • New ApiPlatformUsageProvider marks __construct, non-static properties (READ+WRITE) and PropertyAccessor-style methods as used on classes carrying #[ApiResource] or any HTTP/GraphQL operation attribute — because API Platform instantiates and (de)serializes them at runtime
  • Resolves provider:/processor:/controller: class-string references in operation attributes (including Class::method callable syntax) and filter classes referenced via #[ApiFilter] (class- and property-level)
  • Auto-enabled when api-platform/core, api-platform/metadata, api-platform/state, or api-platform/symfony is installed; opt-in/opt-out via shipmonkDeadCode.usageProviders.apiPlatform.enabled

Resolves #344.

Scope notes

Phase 1 — only flat-style operation attributes on the class (e.g. #[Get(provider: X::class)]) are scanned. The nested form #[ApiResource(operations: [new Get(provider: X::class)])] is not yet covered and can be added in a follow-up.

Co-Authored-By: Claude Code

…ion targets

Resolves #344. Resource classes (classes carrying #[ApiResource] or any
HTTP/GraphQL operation attribute) now have their constructor, non-static
properties (READ+WRITE) and PropertyAccessor-style methods marked as used
because API Platform instantiates and (de)serializes them at runtime.

Also resolves provider/processor/controller class-string references in
operation attributes and filter classes referenced via #[ApiFilter].

Co-Authored-By: Claude Code
@darthf1
Copy link
Copy Markdown

darthf1 commented Apr 25, 2026

Thanks for taking this.

On the attributes there's an input and output property as well which can take a class-string argument, or (this is from memory, can't check right now) it takes an array with a 'class' key and class-string value.

Just fyi, because I did see specific mentioning of controller, processor and provider but not input and output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support api platform attributes

2 participants