Use this module to integrate the API Platform into a Spryker project. A schema-based code generator for API Platform resources in Spryker applications. Define your API resources using YAML schemas and automatically generate PHP classes with full API Platform attribute support.
This module provides a developer-friendly way to define API Platform resources through declarative schema files, similar to Spryker's Transfer object pattern. Resources can be defined across core, feature, and project layers with automatic merging and validation.
- 📝 Schema-based Definition: Define resources using YAML
- 🔄 Multi-layer Support: Core, Feature, and Project layer schemas
- 🎯 ApiType Isolation: Separate configurations for Storefront, Backend, etc.
- ✅ Comprehensive Validation: Post-merge validation with helpful errors
- 🚀 Efficient Generation: Generator-based file discovery for memory efficiency
- 💾 Smart Caching: Automatic cache invalidation based on file changes
- 🔗 Relationship System: Include related resources via
?include=parameter with JSON:API compliance
composer require spryker/api-platform
Default configuration (can be overridden in the bundle config: '%kernel.project_dir%/config/Symfony/{APPLICATION}/packages/spryker_api_platform.php'):
spryker_api_platform:
source_directories:
- src/Spryker
- src/Pyz
cache_dir: '%kernel.cache_dir%/api-generator'
generated_dir: '%kernel.project_dir%/src/Generated/Api'
debug: '%kernel.debug%'# Generate all ApiTypes
docker/sdk glue api:generate
# Generate specific ApiType
docker/sdk glue api:generate Storefront
# Debug a resource
docker/sdk glue api:debug Customer --api-type=StorefrontEnable resources to include related resources via the ?include= query parameter with JSON:API compliance.
# Define relationship in parent resource
includes:
- relationshipName: addresses
targetResource: CustomersAddresses
uriVariableMappings:
customerReference: customerReference
# Define reverse relationship in child resource
includableIn:
- resource: Customers
relationshipName: addressesRequest:
GET /customers/customer--35?include=addresses
Key Features:
- ✅ Declarative YAML configuration
- ✅ Zero provider changes needed
- ✅ Automatic validation
- ✅ Format agnostic (JSON:API, JSON-LD, XML)
- ✅ Performance optimized (compiled configuration)
For comprehensive documentation, see Relationships Guide.