SlideShare a Scribd company logo
API PLATFORM
The PHP framework to build
modern web APIs.
Kévin Dunglas
Founder of Les-Tilleuls.coop
Symfony Core Team member
API Platform creator
Teacher at the University of Lille 1
@dunglas
Les-Tilleuls.coop
Self-managed company since 2011
100% owned by employees
All benefits are equitably shared between employees
18 people, 137% growth in 2015
We are hiring! => jobs@les-tilleuls.coop
The Promise
Support for modern and future formats
Batteries included: pagination, filtering, auth (JWT, OAuth),
HTTP Cache, CORS…
UI and automatic documentation (Swagger)
Extensible, overridable, customizable
A working API in a few minutes
API: State of the Art
HTTP + REST + JSON
Works easily with all programming languages, on every
platforms
Lightweight (= fast)
Stateless (= scale)
Easy to cache (= faster)
High quality tooling (cURL, Varnish…)
REST: a Pattern, Not a
Format
1 project ~= 1 different implementation
Tedious to create: pagination, filtering, validation, caching,
content negotiation, CORS, data interoperability…
Hard to reuse server-side tooling (1 API per project)
Hard to reuse client-side tooling (1 client per API)
Hard to query and aggregate data from different sources
Credit: Martin Fowler
http://martinfowler.com/articles/richardsonMaturityModel.html
HATEOAS / Linked Data
Hypermedia: IRIs (e.g. URLs) as identifiers
Ability to reference external data (like hypertext links)
Hypermedia controls (pagination, filtering…)
The road to better server-side tooling and generic clients
Hypermedia as the Engine of Application State
Creating hypermedia APIs in a few minutes using the API Platform framework
Standards Please!
Swagger / OpenAPI
Describe only I/O formats and available operations for an
API
Most popular way to describe APIs
Lot of tools available (UIs, code generators, validators…)
Open standard (but not endorsed by the W3C)
Not designed for HATEOAS APIs
JSON-LD
Standard: W3C recommandation (since 2014)
Easy to use: looks like a typical JSON document
Already chosen by Google, BBC, Microsoft, US gov...
Compliant with technologies of the semantic web: RDF,
SPARQL, triple store...
JSON for Linked Data
Schema.org
Large set of elements: people, creative works, events,
products, chemicals...
Created (and understood by) Google, Bing, Yahoo! et Yandex
Massively used, and hosted by the W3C (Web schemas
group)
Supports HTML’s microdata, RDFa and JSON-LD
Open vocabulary for data interoperability at web scale
Extension mechanism, compatible with proprietary/custom
vocabularies (yours)
Hydra
Write support (POST, PUT, PATCH…)
Make APIs auto-discoverable (all available operations are
documented)
A standard for describing collections, paginations, filters,
errors…
Draft W3C (Work In Progress)
Describe REST APIs in JSON-LD
Creating hypermedia APIs in a few minutes using the API Platform framework
Creating hypermedia APIs in a few minutes using the API Platform framework
Getting Started with
API Platform
A framework for the new web.
The Promise
Support for modern and future formats (JSON-LD,
Hydra, HAL, schema.org, API+Problem…)
Batteries included: pagination, filtering, auth (JWT, OAuth),
HTTP Cache, CORS…
Awesome UI and automatic documentation (Swagger)
Extensible, overridable, customizable
A working API in a few minutes
Install
Get Docker
If you don’t already have it…
Install
Start the LAMP stack (PHP7, Apache and MySQL)
$ docker-compose up
# Create the database
$ docker-compose exec web bin/console doctrine:schema:create
Go to api-platform.com then click « Download »
Done! Browse http://localhost.
Creating hypermedia APIs in a few minutes using the API Platform framework
It’s Symfony…
Configured with the most popular libraries
for APIs
Compatible with all existing bundles
Use Doctrine ORM by default (but you can
use the persistence system you want)
Symfony full stack application
…with something more
Create your Own
Data Model
Write some PHPDoc (optional)
Add the @ApiResource annotation
Map its properties using the
Doctrine ORM
Update the database schema
$ docker-compose run web bin/console
doctrine:schema:update --force
Create a Plain Old PHP Object
Your 1st API
Platform App is Up
and Running!
Creating hypermedia APIs in a few minutes using the API Platform framework
Out of the Box Features
JSON-LD + Hydra formats
Swagger documentation
Fully featured UI (working for all URLs of the API)
Create (POST), Retrieve (GET item and lists), Update
(PUT) and Delete (DELETE) resources
Pagination for lists (30 items per page), fully configurable
Add
validation rules
Many validation constraints available
Ability to create custom constraints
Use the Symfony Validator
component
Creating hypermedia APIs in a few minutes using the API Platform framework
The Schema Generator
Pick an existing data model from (resources and properties) from
schema.org:
docker-compose run web
vendor/bin/schema generate-types src/ app/config/schema.yml
The Schema Generator
The Schema Generator
PHP classes, properties, getters and setters (PSR compliant)
Doctrine ORM mapping (including relations and mapped superclasses)
Validation constraints
Full PHPDoc extracted from schema human-readable descriptions
Mapping with schema.org's IRIs
The generator uses schema.org data to automatically bootstrap:
Relations between classes (supported by the API system too)
Hypermedia relations
Creating hypermedia APIs in a few minutes using the API Platform framework
Embedded relations
Embedded relations
Content Negotiation
Adding a new format is as simple as creating a new
Symfony Normalizer for it
Built-in formats: JSON-LD, HAL, XML, YAML, CSV, JSON, HTML (UI)
To retrieve a resource in a given format: add an Accept
HTTP header or use the format name as file extension
Content Negotiation
Content Negotiation: HAL
Content Negotiation: XML
Filters
Register the filter service (built-in or custom):
Map the filter to the resource
Filters
The Event System
Events
There is Much More to See
Platform
A Growing Community
100+ awesome contributors (code and docs)
1.2k stars on GitHub
500+ followers on Twitter
Next Big Things (v2.1)
JSONAPI support
GraphQL support
Native MongoDB support
Your contribution?
Thanks!
Any questions?
api-platform/api-platform @ApiPlatform
https://api-platform.com

More Related Content

PDF
API Platform: Full Stack Framework Resurrection
PDF
API Platform and Symfony: a Framework for API-driven Projects
PDF
API Platform: A Framework for API-driven Projects
PDF
API Platform 2.1: when Symfony meets ReactJS (Symfony Live 2017)
PDF
Symfony3 w duecie z Vue.js
PDF
JWT - Sécurisez vos APIs
PDF
Utiliser Webpack dans une application Symfony
PDF
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
API Platform: Full Stack Framework Resurrection
API Platform and Symfony: a Framework for API-driven Projects
API Platform: A Framework for API-driven Projects
API Platform 2.1: when Symfony meets ReactJS (Symfony Live 2017)
Symfony3 w duecie z Vue.js
JWT - Sécurisez vos APIs
Utiliser Webpack dans une application Symfony
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi

What's hot (19)

PDF
A Journey from Hexagonal Architecture to Event Sourcing - SymfonyCon Cluj 2017
PDF
Building APIs in an easy way using API Platform
PDF
Webpack Encore Symfony Live 2017 San Francisco
PDF
Full Stack Scala
PDF
Laravel 5 Annotations: RESTful API routing
PDF
Prototyping applications with heroku and elasticsearch
PDF
How to create aws s3 bucket using terraform
PDF
Deployment and Management on AWS:
 A Deep Dive on Options and Tools
PPTX
Introduction to laravel framework
PPT
Red5 - PHUG Workshops
PPT
Introduction to REST and the Restlet Framework
ODP
Sun Web Server Brief
PDF
Deploy and Scale your PHP App with AWS ElasticBeanstalk and Docker- PHPTour L...
PDF
Unleash the power of HTTP with ASP.NET Web API
PPT
CloudStack S3
PPTX
Aws ebs snapshot with iam cross account access
PPTX
PHP konferencija - Microsoft
PDF
Infrastructure as code with Amazon Web Services
PDF
State of integration with Apache Camel (ApacheCon 2019)
A Journey from Hexagonal Architecture to Event Sourcing - SymfonyCon Cluj 2017
Building APIs in an easy way using API Platform
Webpack Encore Symfony Live 2017 San Francisco
Full Stack Scala
Laravel 5 Annotations: RESTful API routing
Prototyping applications with heroku and elasticsearch
How to create aws s3 bucket using terraform
Deployment and Management on AWS:
 A Deep Dive on Options and Tools
Introduction to laravel framework
Red5 - PHUG Workshops
Introduction to REST and the Restlet Framework
Sun Web Server Brief
Deploy and Scale your PHP App with AWS ElasticBeanstalk and Docker- PHPTour L...
Unleash the power of HTTP with ASP.NET Web API
CloudStack S3
Aws ebs snapshot with iam cross account access
PHP konferencija - Microsoft
Infrastructure as code with Amazon Web Services
State of integration with Apache Camel (ApacheCon 2019)
Ad

Similar to Creating hypermedia APIs in a few minutes using the API Platform framework (20)

PPT
UIT: Our Skills
PPTX
Angular jS Introduction by Google
 
PDF
Students of Navgujarat College of Computer Applications, Ahmedabad felt excit...
PPTX
Advanced JavaScript
PDF
A high profile project with Symfony and API Platform: beIN SPORTS
PPT
Structured Dynamics' Semantic Technologies Product Stack
PDF
Full Stack Developer: The Backbone of Modern Web Applications
PPTX
Building A Platform From Open Source At Yahoo
PDF
Master Python Full Stack: Build & Deploy Robust Web Apps!
PPT
What is WebDAV - uploaded by Murali Krishna Nookella
PPTX
Technology Stack Discussion
PPT
Programming With Amazon, Google, And E Bay
PPT
How To Implement a CMS
PDF
Creating Restful Web Services with restish
PDF
Introduction to JavaScript Frameworks: React vs Angular vs Vue Compared
PPS
Web 2.0 Mimbar Ilmiah
PPTX
Web technologies lesson 1
PDF
Yuriy Gerasimov. Drupal Services. Integration with third party applications. ...
PPTX
Dspace 7 presentation
DOCX
David_Thomas_Resume_Software_08_29_16
UIT: Our Skills
Angular jS Introduction by Google
 
Students of Navgujarat College of Computer Applications, Ahmedabad felt excit...
Advanced JavaScript
A high profile project with Symfony and API Platform: beIN SPORTS
Structured Dynamics' Semantic Technologies Product Stack
Full Stack Developer: The Backbone of Modern Web Applications
Building A Platform From Open Source At Yahoo
Master Python Full Stack: Build & Deploy Robust Web Apps!
What is WebDAV - uploaded by Murali Krishna Nookella
Technology Stack Discussion
Programming With Amazon, Google, And E Bay
How To Implement a CMS
Creating Restful Web Services with restish
Introduction to JavaScript Frameworks: React vs Angular vs Vue Compared
Web 2.0 Mimbar Ilmiah
Web technologies lesson 1
Yuriy Gerasimov. Drupal Services. Integration with third party applications. ...
Dspace 7 presentation
David_Thomas_Resume_Software_08_29_16
Ad

More from Les-Tilleuls.coop (11)

PDF
Symfony on steroids
: Vue.js, Mercure, Panther
PDF
Official "push" and real-time capabilities for Symfony and API Platform (Merc...
PDF
Progressively enhance your Symfony 4 app using Vue, API Platform, Mercure and...
PDF
HTTP/2: speed up your apps and dispatch real time updates (Symfony and API Pl...
PDF
Panther: test your Symfony apps with real web browsers
PDF
Symfony 2 : Performances et Optimisations
PDF
Diaporama du sfPot Lillois du 20 mars 2014
PDF
Workshop HTML5 : référencement grâce à la sémantique
PDF
Atelier #3 intégration html
PDF
Atelier #2 initiation à css
PDF
Atelier initiation au html5
Symfony on steroids
: Vue.js, Mercure, Panther
Official "push" and real-time capabilities for Symfony and API Platform (Merc...
Progressively enhance your Symfony 4 app using Vue, API Platform, Mercure and...
HTTP/2: speed up your apps and dispatch real time updates (Symfony and API Pl...
Panther: test your Symfony apps with real web browsers
Symfony 2 : Performances et Optimisations
Diaporama du sfPot Lillois du 20 mars 2014
Workshop HTML5 : référencement grâce à la sémantique
Atelier #3 intégration html
Atelier #2 initiation à css
Atelier initiation au html5

Recently uploaded (20)

PPTX
CHAPTER 2 - PM Management and IT Context
PPTX
history of c programming in notes for students .pptx
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Introduction to Artificial Intelligence
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
Essential Infomation Tech presentation.pptx
PDF
System and Network Administration Chapter 2
PDF
Understanding Forklifts - TECH EHS Solution
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
medical staffing services at VALiNTRY
CHAPTER 2 - PM Management and IT Context
history of c programming in notes for students .pptx
2025 Textile ERP Trends: SAP, Odoo & Oracle
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Introduction to Artificial Intelligence
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
wealthsignaloriginal-com-DS-text-... (1).pdf
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Wondershare Filmora 15 Crack With Activation Key [2025
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Essential Infomation Tech presentation.pptx
System and Network Administration Chapter 2
Understanding Forklifts - TECH EHS Solution
Operating system designcfffgfgggggggvggggggggg
How to Migrate SBCGlobal Email to Yahoo Easily
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
VVF-Customer-Presentation2025-Ver1.9.pptx
Reimagine Home Health with the Power of Agentic AI​
medical staffing services at VALiNTRY

Creating hypermedia APIs in a few minutes using the API Platform framework

  • 1. API PLATFORM The PHP framework to build modern web APIs.
  • 2. Kévin Dunglas Founder of Les-Tilleuls.coop Symfony Core Team member API Platform creator Teacher at the University of Lille 1 @dunglas
  • 3. Les-Tilleuls.coop Self-managed company since 2011 100% owned by employees All benefits are equitably shared between employees 18 people, 137% growth in 2015 We are hiring! => [email protected]
  • 4. The Promise Support for modern and future formats Batteries included: pagination, filtering, auth (JWT, OAuth), HTTP Cache, CORS… UI and automatic documentation (Swagger) Extensible, overridable, customizable A working API in a few minutes
  • 5. API: State of the Art
  • 6. HTTP + REST + JSON Works easily with all programming languages, on every platforms Lightweight (= fast) Stateless (= scale) Easy to cache (= faster) High quality tooling (cURL, Varnish…)
  • 7. REST: a Pattern, Not a Format 1 project ~= 1 different implementation Tedious to create: pagination, filtering, validation, caching, content negotiation, CORS, data interoperability… Hard to reuse server-side tooling (1 API per project) Hard to reuse client-side tooling (1 client per API) Hard to query and aggregate data from different sources
  • 9. HATEOAS / Linked Data Hypermedia: IRIs (e.g. URLs) as identifiers Ability to reference external data (like hypertext links) Hypermedia controls (pagination, filtering…) The road to better server-side tooling and generic clients Hypermedia as the Engine of Application State
  • 12. Swagger / OpenAPI Describe only I/O formats and available operations for an API Most popular way to describe APIs Lot of tools available (UIs, code generators, validators…) Open standard (but not endorsed by the W3C) Not designed for HATEOAS APIs
  • 13. JSON-LD Standard: W3C recommandation (since 2014) Easy to use: looks like a typical JSON document Already chosen by Google, BBC, Microsoft, US gov... Compliant with technologies of the semantic web: RDF, SPARQL, triple store... JSON for Linked Data
  • 14. Schema.org Large set of elements: people, creative works, events, products, chemicals... Created (and understood by) Google, Bing, Yahoo! et Yandex Massively used, and hosted by the W3C (Web schemas group) Supports HTML’s microdata, RDFa and JSON-LD Open vocabulary for data interoperability at web scale Extension mechanism, compatible with proprietary/custom vocabularies (yours)
  • 15. Hydra Write support (POST, PUT, PATCH…) Make APIs auto-discoverable (all available operations are documented) A standard for describing collections, paginations, filters, errors… Draft W3C (Work In Progress) Describe REST APIs in JSON-LD
  • 18. Getting Started with API Platform A framework for the new web.
  • 19. The Promise Support for modern and future formats (JSON-LD, Hydra, HAL, schema.org, API+Problem…) Batteries included: pagination, filtering, auth (JWT, OAuth), HTTP Cache, CORS… Awesome UI and automatic documentation (Swagger) Extensible, overridable, customizable A working API in a few minutes
  • 20. Install Get Docker If you don’t already have it…
  • 21. Install Start the LAMP stack (PHP7, Apache and MySQL) $ docker-compose up # Create the database $ docker-compose exec web bin/console doctrine:schema:create Go to api-platform.com then click « Download » Done! Browse http://localhost.
  • 23. It’s Symfony… Configured with the most popular libraries for APIs Compatible with all existing bundles Use Doctrine ORM by default (but you can use the persistence system you want) Symfony full stack application …with something more
  • 24. Create your Own Data Model Write some PHPDoc (optional) Add the @ApiResource annotation Map its properties using the Doctrine ORM Update the database schema $ docker-compose run web bin/console doctrine:schema:update --force Create a Plain Old PHP Object
  • 25. Your 1st API Platform App is Up and Running!
  • 27. Out of the Box Features JSON-LD + Hydra formats Swagger documentation Fully featured UI (working for all URLs of the API) Create (POST), Retrieve (GET item and lists), Update (PUT) and Delete (DELETE) resources Pagination for lists (30 items per page), fully configurable
  • 28. Add validation rules Many validation constraints available Ability to create custom constraints Use the Symfony Validator component
  • 30. The Schema Generator Pick an existing data model from (resources and properties) from schema.org: docker-compose run web vendor/bin/schema generate-types src/ app/config/schema.yml
  • 32. The Schema Generator PHP classes, properties, getters and setters (PSR compliant) Doctrine ORM mapping (including relations and mapped superclasses) Validation constraints Full PHPDoc extracted from schema human-readable descriptions Mapping with schema.org's IRIs The generator uses schema.org data to automatically bootstrap: Relations between classes (supported by the API system too)
  • 37. Content Negotiation Adding a new format is as simple as creating a new Symfony Normalizer for it Built-in formats: JSON-LD, HAL, XML, YAML, CSV, JSON, HTML (UI) To retrieve a resource in a given format: add an Accept HTTP header or use the format name as file extension
  • 41. Filters Register the filter service (built-in or custom): Map the filter to the resource
  • 45. There is Much More to See
  • 47. A Growing Community 100+ awesome contributors (code and docs) 1.2k stars on GitHub 500+ followers on Twitter
  • 48. Next Big Things (v2.1) JSONAPI support GraphQL support Native MongoDB support Your contribution?