API Platform Documentation

The Distribution: Create Powerful APIs with Ease

  1. Getting Started with API Platform: Hypermedia and GraphQL API, Admin and Progressive Web App
    1. Installing the Framework
    2. It's Ready!
    3. Bringing your Own Model
    4. Validating Data
    5. Adding GraphQL Support
    6. The Admin
    7. A React Progressive Web App
    8. Hooking Your Own Business Logic
    9. Other Features
    10. Screencasts
  2. Testing the API
    1. Creating Data Fixtures
    2. Writing Functional Tests
    3. Writing Unit Tests
    4. Additional and Alternative Testing Tools
  3. Debugging
    1. Xdebug
    2. Add a Development Stage to the Dockerfile
    3. Configure Xdebug with Docker Compose Override
    4. Troubleshooting

The API Component

  1. The API Platform Core Library
    1. Features
    2. Screencasts
  2. Getting started
    1. Installing API Platform Core
    2. Before Reading this Documentation
    3. Mapping the Entities
  3. General Design Considerations
  4. Extending API Platform
    1. Doctrine Specific Extension Points
    2. Leveraging the Built-in Infrastructure Using Composition
  5. Testing Utilities
    1. The Test HttpClient
    2. API Test Assertions
    3. HTTP Test Assertions
  6. Operations
    1. Enabling and Disabling Operations
    2. Configuring Operations
    3. Prefixing All Routes of All Operations
  7. GraphQL Support
    1. Enabling GraphQL
    2. GraphiQL
    3. GraphQL Playground
    4. Modifying or Disabling the Default IDE
    5. Request with application/graphql Content-Type
    6. Queries
    7. Mutations
    8. Workflow of the Resolvers
    9. Events
    10. Filters
    11. Pagination
    12. Security
    13. Serialization Groups
    14. Name Conversion
    15. Custom Types
    16. Modify the Extracted Types
    17. Changing the Serialization Context Dynamically
    18. Export the Schema in SDL
    19. Handling File Upload
  8. Data Providers
    1. Custom Collection Data Provider
    2. Custom Item Data Provider
    3. Injecting the Serializer in an ItemDataProvider
    4. Injecting Extensions (Pagination, Filter, EagerLoading etc.)
    5. Community Data Providers
  9. Data Persisters
    1. Creating a Custom Data Persister
  10. Filters
    1. Doctrine ORM and MongoDB ODM Filters
    2. Elasticsearch Filters
    3. Serializer Filters
    4. Creating Custom Filters
    5. ApiFilter Annotation
  11. Subresources
    1. Using Serialization Groups
    2. Using Custom Paths
  12. 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. Changing the Serialization Context Dynamically
    7. Changing the Serialization Context on a Per-item Basis
    8. Name Conversion
    9. Decorating a Serializer and Adding Extra Data
    10. Entity Identifier Case
    11. Embedding the JSON-LD Context
    12. Collection Relation
  13. Validation
    1. Validating Submitted Data
    2. Using Validation Groups
    3. Using Validation Groups on Operations
    4. Dynamic Validation Groups
    5. Error Levels and Payload Serialization
    6. Validation on Collection Relations
    7. Open Vocabulary Generated from Validation Metadata
  14. 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
  15. 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
  16. 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
  17. 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
  18. Overriding Default Order
  19. 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
  20. Extensions
    1. Custom Doctrine ORM Extension
    2. Custom Doctrine MongoDB ODM Extension
    3. Custom Elasticsearch Extension
  21. 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
  22. Using Data Transfer Objects (DTOs)
    1. Specifying an Input or an Output Data Representation
    2. Updating a Resource with a Custom Input
    3. Disabling the Input or the Output
    4. Input/Output Metadata
    5. Using Objects As Relations Inside Resources
    6. Validating Data Transfer Objects
  23. OpenAPI Specification Support (formerly Swagger)
    1. Using the OpenAPI Command
    2. Overriding the OpenAPI Specification
    3. Using the OpenAPI and Swagger Contexts
    4. Changing the Name of a Definition
    5. Changing Operations in the OpenAPI Documentation
    6. Changing the Location of Swagger UI
    7. Overriding the UI Template
    8. Compatibility Layer with Amazon API Gateway
  24. JSON Schema Support
    1. Generating a JSON Schema
    2. Generating a JSON Schema Programmatically
    3. Testing
  25. Pushing Live Updates Using the Mercure Protocol
    1. Installing Mercure Support
    2. Pushing the API Updates
    3. Dispatching Private Updates (Authorized Mode)
  26. Pushing Related Resources Using HTTP/2
  27. Errors Handling
    1. Converting PHP Exceptions to HTTP Errors
  28. Using External Vocabularies
  29. Operation Path Naming
    1. Configuration
    2. Create a Custom Operation Path Resolver
  30. Extending JSON-LD AND Hydra Contexts
    1. JSON-LD
    2. Hydra
  31. Identifiers
    1. Custom Identifier Normalizer
    2. Supported Identifiers
  32. MongoDB Support
    1. Overview
    2. Enabling MongoDB Support
    3. Creating Documents
    4. Filtering
    5. Creating Custom Extensions
  33. Elasticsearch Support
    1. Overview
    2. Enabling Reading Support
    3. Creating Models
    4. Filtering
    5. Creating Custom Extensions
  34. Creating Custom Operations and Controllers
    1. Using Serialization Groups
    2. Retrieving the Entity
    3. Alternative Method
  35. The Event System
    1. Built-in Event Listeners
    2. Custom Event Listeners
  36. Handling File Upload
    1. Installing VichUploaderBundle
    2. Configuring the Entity Receiving the Uploaded File
    3. Handling File Upload
    4. Resolving the File URL
    5. Making a Request to the /media_objects Endpoint
    6. Linking a MediaObject Resource to Another Resource
  37. JWT Authentication
    1. Installing LexikJWTAuthenticationBundle
    2. Configuring the Symfony SecurityBundle
    3. Documenting the Authentication Mechanism with Swagger/Open API
    4. Testing with Behat
  38. Accept application/x-www-form-urlencoded Form Data
    1. Create your DeserializeListener Decorator
    2. Creating the Service Definition
  39. AngularJS Integration
    1. Restangular
    2. ng-admin
  40. FOSUserBundle Integration
    1. Installing the Bundle
    2. Enabling the Bridge
    3. Creating a User Entity with Serialization Groups
  41. NelmioApiDocBundle Integration
  42. Configuration

The Schema Generator Component

  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. Model Scaffolding
    3. Cardinality Extraction
  3. Configuration
    1. Customizing PHP Namespaces
    2. Forcing a Field Range
    3. Forcing a Field Cardinality
    4. Forcing a Relation Table Name
    5. Forcing (or Disabling) a Class Parent
    6. Forcing a Class to be Abstract
    7. Forcing a Nullable Property
    8. Forcing a Unique Property
    9. Making a Property Read-Only
    10. Making a Property Write-Only
    11. Forcing a Property to be in a Serialization Group
    12. Forcing an Embeddable Class to be Embedded
    13. Author PHPDoc
    14. Disabling Generators and Creating Custom Ones
    15. Skipping Accessor Method Generation
    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 Annotations
    23. Forcing Doctrine Inheritance Mapping Annotation
    24. Interfaces and Doctrine Resolve Target Entity Listener
    25. Custom Schemas
    26. Checking GoodRelation Compatibility
    27. PHP File Header
    28. Full Configuration Reference

The Admin Component

  1. The API Platform Admin
    1. Features
  2. Getting Started
    1. Installation
    2. Creating the Admin
  3. 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
  4. Handling Relations to Collections
    1. Using an Autocomplete Input for Relations
  5. Using the Schema.org Vocabulary
    1. Displaying Related Resource's Name Instead of its IRI
    2. Emails, URLs and Identifiers
  6. Authentication Support

The Client Generator Component

  1. The API Platform Client Generator
    1. Features
  2. React Generator
    1. Install
    2. Generating a Progressive Web App
    3. Screenshots
  3. Next.js Generator
    1. Install
    2. Generating Routes
    3. Starting the Project
    4. Screenshots
  4. React Native generator
    1. Install
    2. Generating a Native App
    3. Screenshots in iOS Simulator
  5. Vue.js Generator
  6. Vuetify Generator
  7. Quasar Framework Generator
  8. TypeScript Interfaces
    1. Example
  9. Troubleshooting

Deployment

  1. Deploying API Platform Applications
  2. Deploying to a Kubernetes Cluster
    1. Preparing Your Cluster and Your Local Machine
    2. Creating and Publishing the Docker Images
    3. Deploying
    4. Initializing the Database
    5. Tiller RBAC Issue
  3. Deploying with Docker Compose
    1. Installing the Docker Compose Setup for Production
    2. Building and Pushing the Docker Images
    3. Pulling the Docker Images and Running the Services
  4. Deploying an API Platform App on Heroku
  5. Implement Traefik Into API Platform Dockerized
    1. Basic Implementation
    2. Known Issues
    3. Going Further

Extra

  1. The Release Process
  2. API Platform's Philosophy
  3. 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" 502 Error
  4. Contribution guides
  5. Contributor Code of Conduct
    1. Our Pledge
    2. Our Standards
    3. Our Responsibilities
    4. Scope
    5. Enforcement
    6. Attribution