demo
demo copied to clipboard
Demo app for the API Platform framework
This application is a demonstration for the API Platform Framework. Try it online at https://demo.api-platform.com.
Install
Read the official "Getting Started" guide.
$ git clone https://github.com/api-platform/demo.git
$ cd demo
$ docker compose up -d
You can now go to https://localhost
What Can I Find In This Demo?
This demo application contains several things you may be interested.
API Testing
All entities used in this project are thoroughly tested. Each test class extends
the ApiTestCase, which contains specific API assertions. It will make your tests
much more straightforward than using the standard WebTestCase provided by Symfony.
- Tests documentation
- Code in api/tests/
Custom Data Provider
This example shows how to expose a CSV file as a standard API Platform endpoint. It also shows how to make this endpoint paginated with an extension.
- Data providers documentation
- Code in api/src/DataProvider
Overriding the OpenAPI Specification
This example shows how to document an API endpoint that isn't handled by API Platform. This "legacy" endpoint is listed and testable like the other ones thanks to the Swagger interface.
- Overriding the OpenAPI Specification documentation
- Code in api/src/OpenApi/OpenApiFactory.php
Custom Doctrine ORM Filter
This example shows how to implement a custom API filter using Doctrine. It allows to filter archived items with a GET parameter. There are three modes:
- no filter (default)
- only archived item (
?archived=1) - exclude archived items (
?archived=0)
Links:
- Creating Custom Doctrine ORM Filters documentation
- Code in api/src/Filter
Contributing
Read the contributing guide
Credits
Created by Kévin Dunglas. Commercial support available at Les-Tilleuls.coop.
