Slide 1

Slide 1 text

The API-First Framework Gets New Superpowers

Slide 2

Slide 2 text

About me ✔ API Platform creator ✔ Les-Tilleuls.coop founder Kévin Dunglas @dunglas dunglas.fr

Slide 3

Slide 3 text

Improved Developer eXperience 01 02 03 04 Re-Engineered Design Standalone Client Tools New Roadmap

Slide 4

Slide 4 text

But… Where Is API Platform 3?!

Slide 5

Slide 5 text

Antoine Bluchet aka soyuka ✔ API Platform 3 lead ✔ Long-time Core Team member ✔ Famous FOSS contributor ○ pm2 maintainer ○ JS, PHP, Go…

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

Let’s Release It Now! ✔ Test, fix, test 🔁 ✔ Write docs and changelogs ✔ Write blog posts ✔ Tag 10th of packages ✔ Update the distribution

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

Let’s Celebrate API Platform Release Party 6pm @ Les Sales Mômes

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

01 - Re-Engineered Design

Slide 12

Slide 12 text

API Platform Core Values ✔ Easy to use… - Rapid Application Development ✔ …but suitable for advanced use cases - DDD, Clean Architecture, microservices… ✔ Batteries included ✔ Fast, cheap, and green ✔ Standards-compliant

Slide 13

Slide 13 text

Pain Points With v2 ✔ “Subresources” (e.g. /organization/1/users/22) - Read-only - hard to customize ✓ Having small resources linked together instead of big resources improve performance and cache dynamics, cf. my Edge Side APIs presentation ✔ Hooking custom logic - possible but not trivial, not well understood ✓ DDD, Clean Architecture and custom persistence should be intuitive and easy ✔ Configuration - Verbose and hard to read ✓ Leverage PHP 8 attributes 😻

Slide 14

Slide 14 text

Opportunities for v3 ✔ Fix design issues ✔ Leverage new features of our stack ○ Improved PHP attributes and types ○ Symfony, Docker, Next.js, Caddy… ✔ Rely even more on standards ○ RDF ○ OpenAPI ✔ Reduce maintenance burden ○ Remove legacy code

Slide 15

Slide 15 text

Back to The Basics: The Web Architecture ✔ Webapps expose a network of resources ✔ Resources: - Any information that can be named - Valid resources: a thing, a temporary service, a collection of resources ✔ Resources have representations: - Ex: JSON-LD, JPEG, CSV… - The same resource can have multiple representations REST

Slide 16

Slide 16 text

Interesting Standards Resource Description Format (RDF) ✔ Data model for web resources ✔ Various serialization formats: JSON-LD, Turtle, XML-RDF, RDFa… ✔ Classes, properties, links, type system… RDF

Slide 17

Slide 17 text

Interesting Standards Uniform Resource Identifiers (URI): ✔ ID system for web resources ✔ https:/ /example.com/organizations/22/us ers/42 URI

Slide 18

Slide 18 text

Interesting Standards URI Template: ✔ URI that includes parameters to be substituted ✔ https:/ /example.com/organizations/{oID} /users/{uID} URI Template

Slide 19

Slide 19 text

Resource-Oriented Framework DEFINE THE RESOURCES TO EXPOSE

Slide 20

Slide 20 text

PHP As an API Specification Language ✔ Describe the public data model exposed by the API ✔ Leverage the expressivity of PHP: - Types, visibility, relations, attributes… ✔ Resource objects are DTOs

Slide 21

Slide 21 text

Resource-Oriented Framework ✔ Provides the infrastructure layer of your API ✔ Serializes resources representations from PHP objects ✔ Transforms resources representations in PHP objects

Slide 22

Slide 22 text

Define The Resources Define your resources

Slide 23

Slide 23 text

New: Import Your Data Model ✔ Create or use an existing RDF vocabulary… ✔ … or an OpenAPI Definition ✔ Run Schema Generator 5 to generate the PHP classes $ bin/schema generate \ src/ model-definition.yaml Design your API with Stoplight

Slide 24

Slide 24 text

New: Improved Metadata ✔ PHP 8.1’s nested attributes ✔ Based on URI templates - Full control on the URL - Read+Write subresources - “Subresources” aren’t special anymore ✔ RDF & OpenAPI annotations (eg. types)

Slide 25

Slide 25 text

Improved Metadata

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

Resource-Oriented Framework PLUG YOUR BUSINESS LOGIC

Slide 28

Slide 28 text

Hook Your Domain

Slide 29

Slide 29 text

State Provider

Slide 30

Slide 30 text

State Processor

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

Still Natively Supported ✔ Doctrine ORM - Postgres, SQLite, MySQL, MariaDB, Oracle, DB2, SQL Server ✔ Doctrine MongoDB ODM ✔ ElasticSearch (read-only) Use them (only) when needed!

Slide 33

Slide 33 text

02 - Improved Developer eXperience

Slide 34

Slide 34 text

New: Better Onboarding $ docker compose up ✔ Buildkit, Docker Compose v2 ✔ Faster and less frequent builds ✔ Faster on Mac and Windows ✔ Cleaner Caddy and PHP config ✔ Still prod-ready (Kubernetes…)

Slide 35

Slide 35 text

New: Native Xdebug Support $ XDEBUG_MODE=debug docker compose up

Slide 36

Slide 36 text

New: Better Next Integration ✔ Brand new Dockerfile ✔ pnpm instead of yarn ✔ Output File Tracing for prod ✔ Faster builds ✔ Slimmer image

Slide 37

Slide 37 text

03 - Standalone Client Tools

Slide 38

Slide 38 text

API Platform Admin ✔ OpenAPI support, works with any API ✔ Real-time updates with Mercure (if enabled on your API) ✔ Improved performance ✔ Better Schema.org compatibility ✔ Uses React Admin 4.3

Slide 39

Slide 39 text

API Platform Create Client ✔ OpenAPI support, works with any API ✔ Improved skeletons - TypeScript - Mercure - Modern libs $ pnpm create \ @api-platform/client

Slide 40

Slide 40 text

04 - New Roadmap

Slide 41

Slide 41 text

New Roadmap ✔ Major version every 2 years - Deprecated code removal - Drop support for non-current Symfony ✔ Minor version every 6 months ✔ Upgrade path: last minor = new major + backward compatibility

Slide 42

Slide 42 text

New Roadmap ✔ September 2022: API Platform 3 and 2.6 ✔ November 2023: Symfony 7.0 ○ API Platform 3.2: compat wit Symfony 6 and 7 ✔ September 2024: API Platform 4.0 & 3.4 ○ API Platform 4.0: Symfony 7 only ✔ 🔁

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

Thank you! ENJOY THE CONFERENCE! @dunglas dunglas;fr Questions during the Q&A session!