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
Ad

Recommended

API Platform: Full Stack Framework Resurrection
API Platform: Full Stack Framework Resurrection
Les-Tilleuls.coop
 
API Platform and Symfony: a Framework for API-driven Projects
API Platform and Symfony: a Framework for API-driven Projects
Les-Tilleuls.coop
 
API Platform: A Framework for API-driven Projects
API Platform: A Framework for API-driven Projects
Les-Tilleuls.coop
 
API Platform 2.1: when Symfony meets ReactJS (Symfony Live 2017)
API Platform 2.1: when Symfony meets ReactJS (Symfony Live 2017)
Les-Tilleuls.coop
 
Symfony3 w duecie z Vue.js
Symfony3 w duecie z Vue.js
X-Coding IT Studio
 
JWT - Sécurisez vos APIs
JWT - Sécurisez vos APIs
André Tapia
 
Utiliser Webpack dans une application Symfony
Utiliser Webpack dans une application Symfony
Alain Hippolyte
 
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Jérémy Derussé
 
A Journey from Hexagonal Architecture to Event Sourcing - SymfonyCon Cluj 2017
A Journey from Hexagonal Architecture to Event Sourcing - SymfonyCon Cluj 2017
Carlos Buenosvinos
 
Building APIs in an easy way using API Platform
Building APIs in an easy way using API Platform
Antonio Peric-Mazar
 
Webpack Encore Symfony Live 2017 San Francisco
Webpack Encore Symfony Live 2017 San Francisco
Ryan Weaver
 
Full Stack Scala
Full Stack Scala
Ramnivas Laddad
 
Laravel 5 Annotations: RESTful API routing
Laravel 5 Annotations: RESTful API routing
Christopher Pecoraro
 
Prototyping applications with heroku and elasticsearch
Prototyping applications with heroku and elasticsearch
protofy
 
How to create aws s3 bucket using terraform
How to create aws s3 bucket using terraform
Katy Slemon
 
Deployment and Management on AWS:
 A Deep Dive on Options and Tools
Deployment and Management on AWS:
 A Deep Dive on Options and Tools
Danilo Poccia
 
Introduction to laravel framework
Introduction to laravel framework
Ahmad Fatoni
 
Red5 - PHUG Workshops
Red5 - PHUG Workshops
Brendan Sera-Shriar
 
Introduction to REST and the Restlet Framework
Introduction to REST and the Restlet Framework
Philip Johnson
 
Sun Web Server Brief
Sun Web Server Brief
Murthy Chintalapati
 
Deploy and Scale your PHP App with AWS ElasticBeanstalk and Docker- PHPTour L...
Deploy and Scale your PHP App with AWS ElasticBeanstalk and Docker- PHPTour L...
Corley S.r.l.
 
Unleash the power of HTTP with ASP.NET Web API
Unleash the power of HTTP with ASP.NET Web API
Filip W
 
CloudStack S3
CloudStack S3
Sebastien Goasguen
 
Aws ebs snapshot with iam cross account access
Aws ebs snapshot with iam cross account access
Naoya Hashimoto
 
PHP konferencija - Microsoft
PHP konferencija - Microsoft
nusmas
 
Infrastructure as code with Amazon Web Services
Infrastructure as code with Amazon Web Services
Julien SIMON
 
State of integration with Apache Camel (ApacheCon 2019)
State of integration with Apache Camel (ApacheCon 2019)
Claus Ibsen
 
A high profile project with Symfony and API Platform: beIN SPORTS
A high profile project with Symfony and API Platform: beIN SPORTS
Smile I.T is open
 
Creating a modern web application using Symfony API Platform Atlanta
Creating a modern web application using Symfony API Platform Atlanta
Jesus Manuel Olivas
 
REST easy with API Platform
REST easy with API Platform
Antonio Peric-Mazar
 

More Related Content

What's hot (19)

A Journey from Hexagonal Architecture to Event Sourcing - SymfonyCon Cluj 2017
A Journey from Hexagonal Architecture to Event Sourcing - SymfonyCon Cluj 2017
Carlos Buenosvinos
 
Building APIs in an easy way using API Platform
Building APIs in an easy way using API Platform
Antonio Peric-Mazar
 
Webpack Encore Symfony Live 2017 San Francisco
Webpack Encore Symfony Live 2017 San Francisco
Ryan Weaver
 
Full Stack Scala
Full Stack Scala
Ramnivas Laddad
 
Laravel 5 Annotations: RESTful API routing
Laravel 5 Annotations: RESTful API routing
Christopher Pecoraro
 
Prototyping applications with heroku and elasticsearch
Prototyping applications with heroku and elasticsearch
protofy
 
How to create aws s3 bucket using terraform
How to create aws s3 bucket using terraform
Katy Slemon
 
Deployment and Management on AWS:
 A Deep Dive on Options and Tools
Deployment and Management on AWS:
 A Deep Dive on Options and Tools
Danilo Poccia
 
Introduction to laravel framework
Introduction to laravel framework
Ahmad Fatoni
 
Red5 - PHUG Workshops
Red5 - PHUG Workshops
Brendan Sera-Shriar
 
Introduction to REST and the Restlet Framework
Introduction to REST and the Restlet Framework
Philip Johnson
 
Sun Web Server Brief
Sun Web Server Brief
Murthy Chintalapati
 
Deploy and Scale your PHP App with AWS ElasticBeanstalk and Docker- PHPTour L...
Deploy and Scale your PHP App with AWS ElasticBeanstalk and Docker- PHPTour L...
Corley S.r.l.
 
Unleash the power of HTTP with ASP.NET Web API
Unleash the power of HTTP with ASP.NET Web API
Filip W
 
CloudStack S3
CloudStack S3
Sebastien Goasguen
 
Aws ebs snapshot with iam cross account access
Aws ebs snapshot with iam cross account access
Naoya Hashimoto
 
PHP konferencija - Microsoft
PHP konferencija - Microsoft
nusmas
 
Infrastructure as code with Amazon Web Services
Infrastructure as code with Amazon Web Services
Julien SIMON
 
State of integration with Apache Camel (ApacheCon 2019)
State of integration with Apache Camel (ApacheCon 2019)
Claus Ibsen
 
A Journey from Hexagonal Architecture to Event Sourcing - SymfonyCon Cluj 2017
A Journey from Hexagonal Architecture to Event Sourcing - SymfonyCon Cluj 2017
Carlos Buenosvinos
 
Building APIs in an easy way using API Platform
Building APIs in an easy way using API Platform
Antonio Peric-Mazar
 
Webpack Encore Symfony Live 2017 San Francisco
Webpack Encore Symfony Live 2017 San Francisco
Ryan Weaver
 
Laravel 5 Annotations: RESTful API routing
Laravel 5 Annotations: RESTful API routing
Christopher Pecoraro
 
Prototyping applications with heroku and elasticsearch
Prototyping applications with heroku and elasticsearch
protofy
 
How to create aws s3 bucket using terraform
How to create aws s3 bucket using terraform
Katy Slemon
 
Deployment and Management on AWS:
 A Deep Dive on Options and Tools
Deployment and Management on AWS:
 A Deep Dive on Options and Tools
Danilo Poccia
 
Introduction to laravel framework
Introduction to laravel framework
Ahmad Fatoni
 
Introduction to REST and the Restlet Framework
Introduction to REST and the Restlet Framework
Philip Johnson
 
Deploy and Scale your PHP App with AWS ElasticBeanstalk and Docker- PHPTour L...
Deploy and Scale your PHP App with AWS ElasticBeanstalk and Docker- PHPTour L...
Corley S.r.l.
 
Unleash the power of HTTP with ASP.NET Web API
Unleash the power of HTTP with ASP.NET Web API
Filip W
 
Aws ebs snapshot with iam cross account access
Aws ebs snapshot with iam cross account access
Naoya Hashimoto
 
PHP konferencija - Microsoft
PHP konferencija - Microsoft
nusmas
 
Infrastructure as code with Amazon Web Services
Infrastructure as code with Amazon Web Services
Julien SIMON
 
State of integration with Apache Camel (ApacheCon 2019)
State of integration with Apache Camel (ApacheCon 2019)
Claus Ibsen
 

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

A high profile project with Symfony and API Platform: beIN SPORTS
A high profile project with Symfony and API Platform: beIN SPORTS
Smile I.T is open
 
Creating a modern web application using Symfony API Platform Atlanta
Creating a modern web application using Symfony API Platform Atlanta
Jesus Manuel Olivas
 
REST easy with API Platform
REST easy with API Platform
Antonio Peric-Mazar
 
API Platform: The Pragmatic API framework
API Platform: The Pragmatic API framework
soyuka1
 
High quality ap is with api platform
High quality ap is with api platform
Nelson Kopliku
 
API Docs Made Right / RAML - Swagger rant
API Docs Made Right / RAML - Swagger rant
Vladimir Shulyak
 
API workshop: Introduction to APIs (TC Camp)
API workshop: Introduction to APIs (TC Camp)
Tom Johnson
 
Creating a modern web application using Symfony API Platform, ReactJS and Red...
Creating a modern web application using Symfony API Platform, ReactJS and Red...
Jesus Manuel Olivas
 
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Tom Johnson
 
Rest API with Swagger and NodeJS
Rest API with Swagger and NodeJS
Luigi Saetta
 
Schema-First API Design
Schema-First API Design
Yos Riady
 
Test-Driven Documentation for your REST(ful) service
Test-Driven Documentation for your REST(ful) service
Jeroen Reijn
 
Dmytro Dziubenko "Developer's toolchain"
Dmytro Dziubenko "Developer's toolchain"
Fwdays
 
Always up to date, testable and maintainable documentation with OpenAPI
Always up to date, testable and maintainable documentation with OpenAPI
GOG.com dev team
 
Scaling with swagger
Scaling with swagger
Tony Tam
 
SVQdotNET: Building APIs with OpenApi
SVQdotNET: Building APIs with OpenApi
Juan Luis Guerrero Minero
 
API Documentation Workshop tcworld India 2015
API Documentation Workshop tcworld India 2015
Tom Johnson
 
PiterPy 2016: Parallelization, Aggregation and Validation of API in Python
PiterPy 2016: Parallelization, Aggregation and Validation of API in Python
Max Klymyshyn
 
Using API platform to build ticketing system (translations, time zones, ...) ...
Using API platform to build ticketing system (translations, time zones, ...) ...
Antonio Peric-Mazar
 
Netflix OSS and HATEOAS deployed on production - JavaLand
Netflix OSS and HATEOAS deployed on production - JavaLand
JWORKS powered by Ordina
 
A high profile project with Symfony and API Platform: beIN SPORTS
A high profile project with Symfony and API Platform: beIN SPORTS
Smile I.T is open
 
Creating a modern web application using Symfony API Platform Atlanta
Creating a modern web application using Symfony API Platform Atlanta
Jesus Manuel Olivas
 
API Platform: The Pragmatic API framework
API Platform: The Pragmatic API framework
soyuka1
 
High quality ap is with api platform
High quality ap is with api platform
Nelson Kopliku
 
API Docs Made Right / RAML - Swagger rant
API Docs Made Right / RAML - Swagger rant
Vladimir Shulyak
 
API workshop: Introduction to APIs (TC Camp)
API workshop: Introduction to APIs (TC Camp)
Tom Johnson
 
Creating a modern web application using Symfony API Platform, ReactJS and Red...
Creating a modern web application using Symfony API Platform, ReactJS and Red...
Jesus Manuel Olivas
 
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Tom Johnson
 
Rest API with Swagger and NodeJS
Rest API with Swagger and NodeJS
Luigi Saetta
 
Schema-First API Design
Schema-First API Design
Yos Riady
 
Test-Driven Documentation for your REST(ful) service
Test-Driven Documentation for your REST(ful) service
Jeroen Reijn
 
Dmytro Dziubenko "Developer's toolchain"
Dmytro Dziubenko "Developer's toolchain"
Fwdays
 
Always up to date, testable and maintainable documentation with OpenAPI
Always up to date, testable and maintainable documentation with OpenAPI
GOG.com dev team
 
Scaling with swagger
Scaling with swagger
Tony Tam
 
API Documentation Workshop tcworld India 2015
API Documentation Workshop tcworld India 2015
Tom Johnson
 
PiterPy 2016: Parallelization, Aggregation and Validation of API in Python
PiterPy 2016: Parallelization, Aggregation and Validation of API in Python
Max Klymyshyn
 
Using API platform to build ticketing system (translations, time zones, ...) ...
Using API platform to build ticketing system (translations, time zones, ...) ...
Antonio Peric-Mazar
 
Netflix OSS and HATEOAS deployed on production - JavaLand
Netflix OSS and HATEOAS deployed on production - JavaLand
JWORKS powered by Ordina
 
Ad

More from Les-Tilleuls.coop (11)

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

Recently uploaded (20)

MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
Maharshi Mallela
 
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
IFI Techsolutions
 
AI for PV: Development and Governance for a Regulated Industry
AI for PV: Development and Governance for a Regulated Industry
Biologit
 
Microsoft-365-Administrator-s-Guide1.pdf
Microsoft-365-Administrator-s-Guide1.pdf
mazharatknl
 
Streamlining CI/CD with FME Flow: A Practical Guide
Streamlining CI/CD with FME Flow: A Practical Guide
Safe Software
 
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
 
A Guide to Telemedicine Software Development.pdf
A Guide to Telemedicine Software Development.pdf
Olivero Bozzelli
 
ElectraSuite_Prsentation(online voting system).pptx
ElectraSuite_Prsentation(online voting system).pptx
mrsinankhan01
 
Simplify Insurance Regulations with Compliance Management Software
Simplify Insurance Regulations with Compliance Management Software
Insurance Tech Services
 
On-Device AI: Is It Time to Go All-In, or Do We Still Need the Cloud?
On-Device AI: Is It Time to Go All-In, or Do We Still Need the Cloud?
Hassan Abid
 
How Automation in Claims Handling Streamlined Operations
How Automation in Claims Handling Streamlined Operations
Insurance Tech Services
 
Best MLM Compensation Plans for Network Marketing Success in 2025
Best MLM Compensation Plans for Network Marketing Success in 2025
LETSCMS Pvt. Ltd.
 
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
 
Advance Doctor Appointment Booking App With Online Payment
Advance Doctor Appointment Booking App With Online Payment
AxisTechnolabs
 
Folding Cheat Sheet # 9 - List Unfolding 𝑢𝑛𝑓𝑜𝑙𝑑 as the Computational Dual of ...
Folding Cheat Sheet # 9 - List Unfolding 𝑢𝑛𝑓𝑜𝑙𝑑 as the Computational Dual of ...
Philip Schwarz
 
Zoneranker’s Digital marketing solutions
Zoneranker’s Digital marketing solutions
reenashriee
 
Introduction to Agile Frameworks for Product Managers.pdf
Introduction to Agile Frameworks for Product Managers.pdf
Ali Vahed
 
Canva Pro Crack Free Download 2025-FREE LATEST
Canva Pro Crack Free Download 2025-FREE LATEST
grete1122g
 
Which Hiring Management Tools Offer the Best ROI?
Which Hiring Management Tools Offer the Best ROI?
HireME
 
Foundations of Marketo Engage - Programs, Campaigns & Beyond - June 2025
Foundations of Marketo Engage - Programs, Campaigns & Beyond - June 2025
BradBedford3
 
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
Maharshi Mallela
 
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
IFI Techsolutions
 
AI for PV: Development and Governance for a Regulated Industry
AI for PV: Development and Governance for a Regulated Industry
Biologit
 
Microsoft-365-Administrator-s-Guide1.pdf
Microsoft-365-Administrator-s-Guide1.pdf
mazharatknl
 
Streamlining CI/CD with FME Flow: A Practical Guide
Streamlining CI/CD with FME Flow: A Practical Guide
Safe Software
 
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
 
A Guide to Telemedicine Software Development.pdf
A Guide to Telemedicine Software Development.pdf
Olivero Bozzelli
 
ElectraSuite_Prsentation(online voting system).pptx
ElectraSuite_Prsentation(online voting system).pptx
mrsinankhan01
 
Simplify Insurance Regulations with Compliance Management Software
Simplify Insurance Regulations with Compliance Management Software
Insurance Tech Services
 
On-Device AI: Is It Time to Go All-In, or Do We Still Need the Cloud?
On-Device AI: Is It Time to Go All-In, or Do We Still Need the Cloud?
Hassan Abid
 
How Automation in Claims Handling Streamlined Operations
How Automation in Claims Handling Streamlined Operations
Insurance Tech Services
 
Best MLM Compensation Plans for Network Marketing Success in 2025
Best MLM Compensation Plans for Network Marketing Success in 2025
LETSCMS Pvt. Ltd.
 
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
 
Advance Doctor Appointment Booking App With Online Payment
Advance Doctor Appointment Booking App With Online Payment
AxisTechnolabs
 
Folding Cheat Sheet # 9 - List Unfolding 𝑢𝑛𝑓𝑜𝑙𝑑 as the Computational Dual of ...
Folding Cheat Sheet # 9 - List Unfolding 𝑢𝑛𝑓𝑜𝑙𝑑 as the Computational Dual of ...
Philip Schwarz
 
Zoneranker’s Digital marketing solutions
Zoneranker’s Digital marketing solutions
reenashriee
 
Introduction to Agile Frameworks for Product Managers.pdf
Introduction to Agile Frameworks for Product Managers.pdf
Ali Vahed
 
Canva Pro Crack Free Download 2025-FREE LATEST
Canva Pro Crack Free Download 2025-FREE LATEST
grete1122g
 
Which Hiring Management Tools Offer the Best ROI?
Which Hiring Management Tools Offer the Best ROI?
HireME
 
Foundations of Marketo Engage - Programs, Campaigns & Beyond - June 2025
Foundations of Marketo Engage - Programs, Campaigns & Beyond - June 2025
BradBedford3
 

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?