REST API for Extbase models. Resources, operations and filters are configured with annotations on the model class (or on a class extending a model of another extension), output with serializer metadata in annotations or YAML. Configuration options follow API Platform, responses use JSON-LD / Hydra format.
Resources and operations
GET,POST,PATCH,PUTandDELETEoperations for Extbase models.- Configurable routing and base path of the API.
- Cascade persistence of relations, including inline (IRRE) relations.
- Slug fields generated according to TCA configuration.
- Multilanguage support (language prefix in URL or
X-Localeheader).
Collections
- Built-in filters: boolean, numeric, uid, contain, order, range, distance and search (partial, match against and exact strategies).
- Ordered UIDs filter and query modifiers - collections in externally resolved order (e.g. from a search engine).
- Pagination.
Output
- Serialization contexts (groups) - different output for every operation.
- Serializer metadata in annotations or YAML, custom handlers and subscribers.
- Typolinks, processed images and file references.
- File upload to FAL.
Access and HTTP
- Access control of operations and filters with expressions (
security,security_post_denormalize). - CORS configuration.
- Opt-in response cache with automatic tag-based invalidation.
Developer tools
- OpenAPI specification and backend module with Swagger UI for documentation and testing of the API.
- Events to customize processing of operations.
composer require sourcebroker/t3apiAdd the route enhancer to the config.yaml of your site:
imports:
- { resource: "EXT:t3api/Configuration/Routing/config.yaml" }Make an API resource from an Extbase model:
use SourceBroker\T3api\Annotation\ApiResource;
/**
* @ApiResource(
* collectionOperations={
* "get"={"path"="/items"},
* },
* itemOperations={
* "get"={"path"="/items/{id}"},
* },
* )
*/
class Item extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
}After flushing caches the items are available under https://example.com/_api/items and
https://example.com/_api/items/1.
https://docs.typo3.org/p/sourcebroker/t3api/main/en-us/
After cloning the repository run:
ddev restart && ddev composer install
ddev ci 14It installs a TYPO3 14 instance at https://14.t3api.ddev.site/ (backend login admin / Password1!) with
EXT:news records exposed as API resources, e.g.:
- https://14.t3api.ddev.site/_api/
- https://14.t3api.ddev.site/_api/news/news
- https://14.t3api.ddev.site/_api/news/news/1
- https://14.t3api.ddev.site/_api/news/categories
Run the Postman tests (full CRUD of news and categories, including image upload) with
ddev composer ci:tests:postman, or the full test suite with ddev composer ci.
See https://docs.typo3.org/p/sourcebroker/t3api/main/en-us/Miscellaneous/Development/Index.html
| t3api | TYPO3 | PHP | Support |
|---|---|---|---|
| 5.x | 12.4, 13.4, 14 | 8.1 - 8.5 | Features, bugfixes, security |
| 4.x | 12.4, 13.4 | 8.1 - 8.3 | None |
| 3.x | 12.4 | 8.1 - 8.3 | None |
| 2.x | 10.4, 11.5 | 7.2 - 8.1 | None |
| 1.x | 8.7 - 10.4 | 7.2 - 7.4 | None |
Only the latest major version is supported. Versions 4.x and below receive no further releases - 5.x supports all TYPO3 versions of 4.x, see the changelog for breaking changes.