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…
Released yesterday (2016-05-16) ▸ Bug fix and security only (no more new features) ▸ Shipped with Symfony 2.8, compatible with SF 3.0 ▸ End Of Life: Nov 2019 (= EOL of SF 2.8) ▸ API Platform v2.0 alpha 1 ▸ Released yesterday ▸ stable release: June (SF 3.1 release: May)
September 18, 2015 ▸ 660+ stars on GitHub ▸ 900+ commits ▸ 5 Core Team Members: Samuel Roze (Inviqa), Teoh Han Hui (Tripviss), Théo Fidry (Haircvt), Vincent Chalamon (Les-Tilleuls.coop) and me ▸ 60+ awesome contributors including Antoine Bluchet, Maxime Steinhausser, Hamza Amrouche, Jérémy Derussé and Charles Sarazin… ▸ Adopted by: Sensiolabs, Smile, The Fork/TripAdvisor, BeIN Sports, Tripviss, Eaux du Nord, Le Parti de Gauche, ExaqtWorld, Ville de Roubaix… And recently by some new major companies (announcement soon).
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) ▸ Use kernel events to hook your custom logic: security (isGranted), cache headers, validation, persistence, call to external APIs, mail…
guess the best response format (content negotiation) ▸ controller: retrieve the data from the persistence system (GET, PUT, DELETE) ▸ controller: deserialize the request (POST, PUT) ▸ controller: return an entity (GET, POST, PUT, DELETE), an array of entities or a pagination (cGET) ▸ kernel.view (priority 20): validate data (POST, PUT) ▸ kernel.view (priority 10): persist data (POST, PUT, DELETE) ▸ kernel.view (priority 0): serialize data and transform them in a Response
format to use depending of the HTTP Accept header ▸ 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
The v1.1 of the Schema Generator is included in API Platform v1.1 and v2 ▸ Available as PHAR ▸ MongoDB support ▸ Symfony v3 compatibility ▸ Doctrine Embeddable support ▸ Support custom properties and entities ▸ Can leverage any RDF(a) vocabulary (lov.okfn.org) ▸ Serialization groups support ▸ Doctrine: unique, nullable and @Column can be customized
SYMFONY SERIALIZER COMPONENT 3.1 ▸ data: URI to SplFileInfo normalizer for file upload ▸ \DateTime normalizer ▸ Nested object serialization ▸ Tree serialization with the @MaxDepth annotation ▸ 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!