API Platform Documentation

The Distribution: Create Powerful APIs with Ease

  1. Getting Started With API Platform: Create Your API and Your Jamstack Site
    1. Introduction
    2. A Bookshop API
    3. Installing the Framework
    4. It's Ready
    5. Bringing your Own Model
    6. Plugging the Persistence System
    7. Validating Data
    8. Adding GraphQL Support
    9. The Admin
    10. A Next.js Web App
    11. Hooking Your Own Business Logic
    12. Other Features
    13. Screencasts
  2. Testing the API
    1. Creating Data Fixtures
    2. Writing Functional Tests
    3. Writing Unit Tests
    4. Additional and Alternative Testing Tools
    5. Using the API Platform Distribution for End-to-end Testing
  3. Debugging
    1. Xdebug
    2. Add a Development Stage to the Dockerfile
    3. Configure Xdebug with Docker Compose Override
    4. Troubleshooting
  4. Configuring the Caddy Web Server

Core

  1. The API Platform Core Library
    1. Features
    2. Screencasts
  2. Getting started
    1. Migrating from FOSRestBundle
    2. Installing API Platform
    3. Before Reading this Documentation
    4. Mapping the Entities
  3. Upgrade Guide
    1. API Platform 2.7/3.0
    2. Changes
    3. The Upgrade Command
    4. Providers/Processors
    5. DataTransformers and DTO Support
  4. General Design Considerations
  5. Extending API Platform
    1. Doctrine Specific Extension Points
    2. Leveraging the Built-in Infrastructure Using Composition
  6. Testing Utilities
    1. The Test HttpClient
    2. API Test Assertions
    3. HTTP Test Assertions
  7. Operations
    1. Enabling and Disabling Operations
    2. Configuring Operations
    3. Prefixing All Routes of All Operations
    4. Defining Which Operation to Use to Generate the IRI
    5. Expose a Model Without Any Routes
  8. GraphQL Support
    1. Enabling GraphQL
    2. Changing Location of the GraphQL Endpoint
    3. GraphiQL
    4. GraphQL Playground
    5. Modifying or Disabling the Default IDE
    6. Request with application/graphql Content-Type
    7. Operations
    8. Queries
    9. Mutations
    10. Subscriptions
    11. Workflow of the Resolvers
    12. Events
    13. Filters
    14. Pagination
    15. Security
    16. Serialization Groups
    17. Exception and Error
    18. Name Conversion
    19. Custom Types
    20. Modify the Extracted Types
    21. Changing the Serialization Context Dynamically
    22. Export the Schema in SDL
    23. Handling File Upload
    24. Change Default Descriptions
  9. State Providers
  10. State Processors
    1. Creating a Custom State Processor
    2. Hooking into the Built-In State Processors
  11. Filters
    1. Doctrine ORM and MongoDB ODM Filters
    2. Elasticsearch Filters
    3. Serializer Filters
    4. Creating Custom Filters
    5. ApiFilter Attribute
  12. Subresources
    1. URI Variables Configuration
  13. The Serialization Process
    1. Overall Process
    2. Available Serializers
    3. The Serialization Context, Groups and Relations
    4. Using Serialization Groups
    5. Using Serialization Groups per Operation
    6. Embedding Relations
    7. Property Normalization Context
    8. Calculated Field
    9. Changing the Serialization Context Dynamically
    10. Changing the Serialization Context on a Per-item Basis
    11. Name Conversion
    12. Decorating a Serializer and Adding Extra Data
    13. Entity Identifier Case
    14. Embedding the JSON-LD Context
    15. Collection Relation
  14. Validation
    1. Validating Submitted Data
    2. Using Validation Groups
    3. Using Validation Groups on Operations
    4. Dynamic Validation Groups
    5. Sequential Validation Groups
    6. Validating Delete Operations
    7. Error Levels and Payload Serialization
    8. Validation on Collection Relations
    9. Open Vocabulary Generated from Validation Metadata
    10. Specification property restrictions
  15. Security
    1. Executing Access Control Rules After Denormalization
    2. Hooking Custom Permission Checks Using Voters
    3. Configuring the Access Control Error Message
    4. Filtering Collection According to the Current User Permissions
    5. Disabling Operations
    6. Changing Serialization Groups Depending of the Current User
  16. Content Negotiation
    1. Configuring Formats Globally
    2. Configuring PATCH Formats
    3. Configuring Error Formats
    4. Configuring Formats For a Specific Resource or Operation
    5. Supporting Custom Formats
  17. Pagination
    1. Disabling the Pagination
    2. Changing the Number of Items per Page
    3. Changing Maximum Items Per Page
    4. Partial Pagination
    5. Cursor-Based Pagination
    6. Controlling The Behavior of The Doctrine ORM Paginator
    7. Custom Controller Action
    8. Pagination for Custom State Providers
  18. Deprecating Resources and Properties (Alternative to Versioning)
    1. Deprecating Resource Classes, Operations and Properties
    2. Setting the Sunset HTTP Header to Indicate When a Resource or an Operation Will Be Removed
  19. Overriding Default Order
  20. Performance and Cache
    1. Enabling the Built-in HTTP Cache Invalidation System
    2. Setting Custom HTTP Cache Headers
    3. Enabling the Metadata Cache
    4. Using PPM (PHP-PM)
    5. Doctrine Queries and Indexes
    6. Profiling with Blackfire.io
  21. Extensions
    1. Custom Doctrine ORM Extension
    2. Custom Doctrine MongoDB ODM Extension
    3. Custom Elasticsearch Extension
  22. Symfony Messenger Integration: CQRS and Async Message Processing
    1. Installing Symfony Messenger
    2. Dispatching a Resource through the Message Bus
    3. Registering a Message Handler
    4. Accessing the Data Returned by the Handler
    5. Detecting Removals
    6. Using Messenger with an Input Object
  23. Using Data Transfer Objects (DTOs)
    1. Implementing a Write Operation With an Input Different From the Resource
    2. Use Messenger With an Input DTO
    3. Implementing a Read Operation With an Output Different From the Resource
  24. OpenAPI Specification Support (formerly Swagger)
    1. Using the OpenAPI Command
    2. Overriding the OpenAPI Specification
    3. Using the OpenAPI and Swagger Contexts
    4. Disabling an Operation From OpenAPI Documentation
    5. Changing the Name of a Definition
    6. Changing Operations in the OpenAPI Documentation
    7. Disabling Swagger UI or ReDoc
    8. Changing the Location of Swagger UI
    9. Using a custom Asset Package in Swagger UI
    10. Overriding the UI Template
    11. Compatibility Layer with Amazon API Gateway
    12. OAuth
    13. Info Object
  25. JSON Schema Support
    1. Generating a JSON Schema
    2. Overriding the JSON Schema Specification
    3. Generating a JSON Schema Programmatically
    4. Testing
  26. Creating Async APIs using the Mercure Protocol
    1. Installing Mercure Support
    2. Pushing the API Updates
    3. Dispatching Private Updates (Authorized Mode)
    4. Available Options
    5. Dispatching Restrictive Updates (Security Mode)
  27. Pushing Related Resources Using HTTP/2
  28. Errors Handling
    1. Converting PHP Exceptions to HTTP Errors
    2. Message Scope
    3. Fine-grained Configuration
  29. Using External Vocabularies
  30. Operation Path Naming
    1. Configuration
    2. Create a Custom Operation Path Resolver
  31. URL Generation Strategy
  32. Extending JSON-LD AND Hydra Contexts
    1. JSON-LD
    2. Hydra
  33. Identifiers
    1. Custom Identifier Normalizer
    2. Changing Identifier in a Doctrine Entity
    3. Supported Identifiers
  34. MongoDB Support
    1. Overview
    2. Enabling MongoDB Support
    3. Creating Documents
    4. Filtering
    5. Creating Custom Extensions
    6. Adding Execute Options
  35. Elasticsearch Support
    1. Overview
    2. Enabling Reading Support
    3. Creating Models
    4. Filtering
    5. Creating Custom Extensions
  36. Creating Custom Operations and Controllers
    1. Using the PlaceholderAction
    2. Using Serialization Groups
    3. Retrieving the Entity
    4. Alternative Method
  37. The Event System
    1. Built-in Event Listeners
    2. Custom Event Listeners
  38. Handling File Upload
    1. Installing VichUploaderBundle
    2. Uploading to a Dedicated Resource
    3. Uploading to an Existing Resource with its Fields
  39. JWT Authentication
    1. Installing LexikJWTAuthenticationBundle
    2. Configuring the Symfony SecurityBundle
    3. Documenting the Authentication Mechanism with Swagger/Open API
    4. Testing
  40. User Entity
    1. Creating the Entity and Repository
    2. Creating and Updating User Password
  41. Accept application/x-www-form-urlencoded Form Data
    1. Create your DeserializeListener Decorator
    2. Creating the Service Definition
  42. AngularJS Integration
    1. Restangular
    2. ng-admin
  43. FOSUserBundle Integration
    1. Installing the Bundle
    2. Creating a User Entity with Serialization Groups
  44. NelmioApiDocBundle Integration
  45. Bootstraping the core library
  46. Configuration
    1. Global Resources Defaults
  47. Migrate From FOSRestBundle
    1. Features Comparison

Schema Generator

  1. The Schema Generator
    1. What Is Schema.org?
    2. Why Use Schema.org Data to Generate a PHP Model?
    3. Documentation
  2. Getting Started
    1. Installation
    2. Configuration
    3. Usage
    4. Load Previously Generated Files
    5. Going Further
  3. Configuration
    1. Customizing PHP Namespaces
    2. Forcing a Field Type (Range)
    3. Forcing a Field Cardinality
    4. Changing the Default Cardinality
    5. Adding a Custom Attribute or Modifying a Generated Attribute
    6. Forcing (or Enabling) a Class Parent
    7. Forcing a Class to be Abstract
    8. Define API Platform Operations
    9. Forcing a Nullable Property
    10. Forcing a Unique Property
    11. Making a Property Read-Only
    12. Making a Property Write-Only
    13. Forcing an Embeddable Class to be Embedded
    14. Skipping Accessor Method Generation
    15. Using Fluent Mutator Methods
    16. Disabling the id Generator
    17. Generating UUIDs
    18. User-submitted UUIDs
    19. Generating Custom IDs
    20. Disabling Usage of Doctrine Collections
    21. Changing the Field Visibility
    22. Generating Assert\Type Attributes
    23. Forcing Doctrine Inheritance Mapping Attribute
    24. Interfaces and Doctrine Resolve Target Entity Listener
    25. Custom Schemas
    26. All Types, Resolve Types and Exclude
    27. Checking GoodRelation Compatibility
    28. Author PHPDoc
    29. PHP File Header
    30. Disabling Generators and Creating Custom Ones
    31. Full Configuration Reference

Admin

  1. The API Platform Admin
    1. Features
  2. Getting Started
    1. Installation
    2. Creating the Admin
  3. Handling Relations
    1. Embedded Relations
    2. Display a Field of an Embedded Relation
    3. Using an Autocomplete Input for Relations
  4. OpenAPI
    1. Data Provider
    2. Mercure Support
  5. Using the Schema.org Vocabulary
    1. Displaying Related Resource's Name Instead of its IRI
    2. Emails, URLs and Identifiers
  6. Validation
    1. Client-side Validation
    2. Server-side Validation
  7. Real-time Updates With Mercure
    1. Advanced Configuration
  8. Authentication Support
  9. Handling File Upload
  10. Performance
    1. Retrieve All Relations in One Request
  11. Customizing the Admin
    1. Customizing the Admin's Main Page and the Resource List
    2. Customizing the List View
    3. Customizing the Show View
    4. Customizing the Create Form
    5. Customizing the Edit Form
    6. Going Further
  12. Components
    1. Resource Components
    2. Page Components
    3. Hydra
    4. OpenAPI
    5. Other Components

Create Client

  1. API Platform Create Client
    1. Generated React and React Native Apps, Updated in Real Time
    2. Features
  2. Next.js Generator
    1. Install
    2. Generating Routes
    3. Starting the Project
    4. Screenshots
  3. Nuxt.js Generator
    1. Install
    2. Updating Nuxt Config
    3. Generating Routes
    4. Updating Default Layout
    5. Starting the Project
    6. Screenshots
  4. Vuetify Generator
    1. Install With Docker
    2. Install Without Docker
    3. Generating the VueJS Web App
  5. Quasar Framework Generator
  6. React Generator
    1. Install
    2. Generating a Web App
    3. Screenshots
  7. React Native generator
    1. Install
    2. Generating a Native App
    3. Screenshots in iOS Simulator
  8. Vue.js Generator
  9. TypeScript Interfaces
    1. Example
  10. Custom Generator
    1. Usage
    2. Example
  11. Troubleshooting
    1. Self-Signed TLS Certificate
    2. Authenticated API
    3. ApiDocumentation doesn't exist
    4. Cannot read property '@type'
    5. Dereferencing a URL did not result in a JSON object
    6. Docker distribution on Windows and hot-reloading

Deployment

  1. Deploying API Platform Applications
  2. Deploying with Docker Compose
    1. Preparing a Server
    2. Configuring a Domain Name
    3. Deploying
    4. Deploying on Multiple Nodes
  3. Deploying to a Kubernetes Cluster
    1. Preparing Your Cluster and Your Local Machine
    2. Creating and Publishing the Docker Images
    3. Deploying with Helm 3
    4. Access the container
    5. Caution for system architecture
    6. Updates
    7. GitHub Actions Example for deployment
    8. Symfony Messenger
  4. Deploying to Minikube
    1. Install Minikube
    2. Building and Pushing Docker Images
    3. Deploying
  5. Deploying an API Platform App on Heroku
  6. Implement Træfik Into API Platform Dockerized
    1. Basic Implementation
    2. Known Issues
    3. Going Further
    4. Multiple Instances
    5. More Generic Approach

General Information

  1. API Platform's Philosophy
  2. The Release Process
    1. Maintenance
  3. API Platform for Enterprise
    1. Enterprise-ready open source software—managed for you
  4. Security Policy
    1. Reporting a Security Issue
    2. Resolving Process
    3. Security Updates With Tidelift
    4. Issue Severity
    5. Credits
  5. Troubleshooting
    1. Using Docker
    2. Using API Platform and JMS Serializer in the same project
    3. "upstream sent too big header while reading response header from upstream" NGINX 502 Error
  6. Contribution guides
  7. Contributor Code of Conduct
    1. Our Pledge
    2. Our Standards
    3. Our Responsibilities
    4. Scope
    5. Enforcement
    6. Attribution

What' new?

API platform conference 2022

Sep 15,16 2022: new edition of our conference dedicated to API Platform and its ecosystem!