Skip to content
sourcebrokerPublic

About

TYPO3 extension t3api. REST API for your TYPO3 project. Config with annotations, built in filtering, pagination, typolinks, image processing, uploads (FAL), serialization contexts, responses in Hydra/JSON-LD format. Api-platform based.

Topics

Resources

Code of conduct

Contributing

Stars

38 stars

Watchers

7 watching

Forks

Repository files navigation

TYPO3 Extension t3api

Latest Stable Version Tests

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.

Features

Resources and operations

  • GET, POST, PATCH, PUT and DELETE operations 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-Locale header).

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.

Quick start

composer require sourcebroker/t3api

Add 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.

Documentation

https://docs.typo3.org/p/sourcebroker/t3api/main/en-us/

Local test instance

After cloning the repository run:

ddev restart && ddev composer install
ddev ci 14

It 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.:

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.

Development

See https://docs.typo3.org/p/sourcebroker/t3api/main/en-us/Miscellaneous/Development/Index.html

Version support

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.

About

TYPO3 extension t3api. REST API for your TYPO3 project. Config with annotations, built in filtering, pagination, typolinks, image processing, uploads (FAL), serialization contexts, responses in Hydra/JSON-LD format. Api-platform based.

Topics

Resources

Code of conduct

Contributing

Stars

38 stars

Watchers

7 watching

Forks

Releases

Contributors

Languages