DunglasApiBundle is an easy to use and powerful system to create hypermedia-driven REST APIs. It is a component of the Dunglas's API Platform framework and it can be used as a standalone bundle for the Symfony framework.
It embraces JSON for Linked Data (JSON-LD) and Hydra Core Vocabulary web standards.
Build a working and fully-featured CRUD API in minutes. Leverage the awesome features of the tool to develop complex and high performance API-first projects.
Here is the fully-featured REST API you'll get in minutes, I promise:
- CRUD support through the API for Doctrine entities: list,
GET
,POST
,PUT
andDELETE
- Hypermedia implementing JSON-LD
- Machine-readable documentation of the API in the Hydra format, guessed from PHPDoc, Serializer, Validator and Doctrine ORM metadata
- Human-readable Swagger-like documentation including a sandbox automatically generated thanks to the integration with NelmioApiDoc
- Pagination (compliant with Hydra)
- List filters (compliant with Hydra)
- Validation using the Symfony Validator Component, with groups support
- Errors serialization (compliant with Hydra)
- Custom serialization using the Symfony Serializer Component, with groups support and the possibility to embed relations
- Automatic routes registration
- Automatic entrypoint generation giving access to all resources
\DateTime
serialization and deserialization- FOSUserBundle integration (user management)
- Easy installation thanks to API Platform
Everything is fully customizable through a powerful event system and strong OOP.
This bundle is documented and tested with Behat (take a look at the features/
directory).
- Getting Started
- Installing DunglasApiBundle
- Configuring the API
- Mapping the entities
- Registering the services
- NelmioApiDocBundle integration
- Operations
- Disabling operations
- Creating custom operations
- Data providers
- Creating a custom data provider
- Returning a paged collection
- Supporting filters
- Extending the Doctrine Data Provider
- Filters
- Search filter
- Date filter
1. Managing
null
values - Order filter 1. Using a custom order query parameter name
- Enabling a filter for all properties of a resource
- Creating custom filters 1. Creating custom Doctrine ORM filters 2. Overriding extraction of properties from the request
- Serialization groups and relations
- Using serialization groups
- Annotations
- Embedding relations 1. Normalization 2. Denormalization
- Name conversion
- Entity identifier case
- Validation
- Using validation groups
- The event system
- Retrieving list
- Retrieving item
- Creating item
- Updating item
- Deleting item
- JSON-LD context builder
- Registering an event listener
- Resources
- Using a custom
Resource
class - Controllers
- Using a custom controller
- FOSUserBundle integration
- Creating a
User
entity with serialization groups - Using external (JSON-LD) vocabularies
- Content negotiation
- Enabling several formats
- Registering a custom format in the Negotiation library
- Registering a custom serializer
- Creating a responder
- Security
- Performance
- Enabling the metadata cache
- AngularJS integration
- LoopBackApiBundle: provides a set of Doctrine ORM filters for more advanced query operations
- (french) A la découverte de API Platform (Symfony Live Paris 2015)
- (french) API-first et Linked Data avec Symfony (sfPot Lille 2015)
DunglasApiBundle is part of the API Platform project. It is developed by Kévin Dunglas, Les-Tilleuls.coop and awesome contributors.