The ultimate PHP framework to build modern web APIs
PHP ApacheConf Shell
Latest commit 822c3cc Jan 6, 2017 @dunglas dunglas Merge branch '2.0'

README.md

The API Platform Framework

Join the chat at https://gitter.im/api-platform/api-platform Build Status Build status Coverage Status SensioLabsInsight Scrutinizer Code Quality Dependency Status

The new breed of web frameworks

API Platform

The official project documentation is available on the API Platform website.

API Platform is a next-generation PHP web framework designed to easily create API-first projects without compromising extensibility and flexibility:

  • Expose in minutes an hypermedia REST API that works out of the box by reusing entity metadata (ORM mapping, validation and serialization) ; that embraces JSON-LD, Hydra and such other data formats like HAL, YAML, XML or CSV and provides a ton of features (CRUD, validation and error handling, relation embedding, filters, ordering...)
  • Enjoy the beautiful automatically generated API documentation (Swagger)
  • Use our awesome code generator to bootstrap a fully-functional data model from Schema.org vocabularies with ORM mapping and validation (you can also do it manually)
  • Easily add JSON Web Token or OAuth authentication
  • Create specs and tests with a developer friendly API context system on top of Behat
  • Develop your website UI, webapp, mobile app or anything else you want using your preferred client-side technologies! Tested and approved with React, AngularJS (integration included), Ionic and native mobile apps

API Platform embraces open web standards (Swagger, JSON-LD, Hydra, HAL, JWT, OAuth, HTTP...) and the Linked Data movement. Your API will automatically expose structured data in Schema.org/JSON-LD. It means that your API Platform application is usable out of the box with technologies of the semantic web.

It also means that your SEO will be improved because Google recommends these formats. And yes, Google crawls full-Javascript applications as well as old-fashioned ones.

Last but not least, API Platform is built on top of the Symfony full-stack framework and follows its best practices. It means than you can:

  • use thousands of Symfony bundles with API Platform
  • integrate API Platform in any existing Symfony application
  • reuse all your Symfony skills and benefit of the incredible amount of Symfony documentation
  • enjoy the popular Doctrine ORM (used by default, but fully optional: you can use the data provider you want, including but not limited to MongoDB ODM and ElasticSearch)

Install

Read the official "Getting Started" guide.

What's inside?

API Platform provides rock solid foundations to build your project:

  • The Schema Generator to generate PHP entities from Schema.org types with Doctrine ORM mappings, Symfony validation and extended PHPDoc
  • The API Platform Core Library to expose in minutes your entities as a JSON-LD and Hydra enabled hypermedia REST API
  • Swagger UI integrated with the API bundle to automatically generate a beautiful human-readable documentation and a sandbox to test the API
  • Behat and Behatch configured to easily test the API
  • The full power of the Symfony framework and its ecosystem
  • Doctrine ORM/DBAL
  • An AppBundle you can use to start coding
  • Annotations enabled for everything
  • Swiftmailer and Twig to create beautiful emails

It comes pre-configured with the following bundles:

  • Symfony - API Platform is built on top of the full-stack Symfony framework
  • API Platform's API bundle - Creates powerful Hypermedia APIs supporting JSON-LD and Hydra
  • DunglasActionBundle - Automatically register actions, commands and event subscribers as a service
  • NelmioCorsBundle - Support for CORS headers
  • NelmioApiDocBundle - Generates a human-readable documentation
  • FosHttpCacheBundle - Add powerful caching capacities, supports Varnish, Nginx a built-in PHP reverse proxy
  • SensioFrameworkExtraBundle - Adds several enhancements, including template and routing annotation capability
  • DoctrineBundle - Adds support for the Doctrine ORM
  • TwigBundle - Adds support for the Twig templating engine (useful in emails)
  • SecurityBundle - Authentication and roles by integrating Symfony's security component
  • SwiftmailerBundle - Adds support for Swiftmailer, a library for sending emails
  • MonologBundle - Adds support for Monolog, a logging library
  • WebProfilerBundle (in dev/test env) - Adds profiling functionality and the web debug toolbar
  • SensioDistributionBundle (in dev/test env) - Adds functionality for configuring and working with Symfony distributions
  • SensioGeneratorBundle (in dev/test env) - Adds code generation capabilities

All libraries and bundles included in API Platform are released under the MIT or BSD license.

Authentication support

Json Web Token is a lightweight and popular way to handle authentication in a stateless way. Install LexikJWTAuthenticationBundle to adds JWT support to API Platform.

Oauth support can also be easily added using FOSOAuthServerBundle.

Enjoy!

Credits

Created by Kévin Dunglas. Sponsored by Les-Tilleuls.coop Commercial support available upon request.