Create web APIs easily (focused on Developer eXperience) ▸ Develop a fully-featured API in minutes ▸ Override and customize everything you need ▸ Be compliant out of the box with the last generation of standards and usages ▸ Linked Data, HATEOAS and semantic web support : JSON-LD, Hydra, schema.org, JWT…
rewrite: fix design limitations from v1 - but contains BC breaks! ▸ « API Platform Core » (formerly DunglasApiBundle) is not a Symfony bundle anymore but a standalone PHP library built with SF components ▸ Usable in raw PHP (Laravel support is coming) ▸ Symfony still the first-class citizen (bundle included) ▸ Implements the Action-Domain-Responder pattern using events of the Symfony kernel (more flexible, easier to customize) ▸ PHP 7+: use new features such as the ?? operator, scalar type hints and return types ▸ Symfony 3.1+: a lof of code from v1 have been moved to SF components: Serializer, PropertyInfo, PropertyAccess
/tasks and GET /tasks/{id} are available ▸ All other operations (POST, PUT, DELETE) are not registered ▸ When using the configuration, declaration must be explicits ▸ Different serialization groups are applied per operation ▸ Only « text » is displayed in the list ▸ « text » and « status » are displayed for the item IRI ▸ Deserialization isn’t impacted (use the denormalization_context key) ▸ Works with XML and YAML mappings too
The event system of v1 has been removed (PRE_CREATE, POST_CREATE, PRE_VALIDATE…) ▸ V2 now relies on Symfony HttpKernel events ▸ V2 implements the Action-Domain-Responder pattern ▸ Events listeners (see next slide) are only applied on request handled by API Platform (not on standard Symfony requests) ▸ Event listeners are autoregistered and autowired (using DunglasActionBundle) ▸ Use kernel events to hook your custom logic: security (isGranted), cache headers, validation, persistence, call to external APIs, mail…
CONTROLLERS? ▸ Create service-oriented (or non-REST) endpoints ▸ Customize URLs ▸ Manage sub-resources (ex: /tasks/{id}/comments/{c_id}) ▸ Hook your own logic when kernel events are not enough ▸ Controllers and actions are autoregistered and autowired (DunglasActionBundle) ▸ Always prefer kernel events when possible!
format to use depending of the HTTP Accept header ▸ Built-in support for JSON-LD, XML, JSON and CSV ▸ Built on top of William Durand’s Negotiation 2 library (same as FOSRest) ▸ Hooks into the Symfony Serializer component ▸ Allows to return hypermedia (HAL, JSON-API…) and non hypermedia (raw JSON, raw XML…) formats
Swagger 2.0 support ▸ Configurable Pagination ▸ Relation handling ▸ Some new filters ▸ Complex type serialization (ex: nested objects) ▸ PSR-6 cache support (performance)
SYMFONY SERIALIZER COMPONENT 3.1/3.2 ▸ data: URI to SplFileInfo normalizer for file upload ▸ \DateTime normalizer ▸ Nested object serialization ▸ Tree serialization with the @MaxDepth annotation ▸ CSV support ▸ Performance improvements ▸ PSR-6 support (performance)
and improve the doc: api-platform/doc#37 ▸ Finish MongoDB support: api-platform/core#461 ▸ Test, test and test again ▸ Improve the website: github.com/api-platform/website ▸ Spread the word!