Getting started

What does it do

T3api extension provides easy configurable and customizable REST API for your Extbase models. It allows to configure whole API functionality with annotations for classes, properties and methods.

Most of configuration options is based on API Platform to make it easier to use for developers experienced in this awesome framework.

T3api comes with partial support of JSON-LD and Hydra, which allows to build smart frontend applications with auto-discoverability capabilities.

Installation

Run

composer require sourcebroker/t3api
Copied!

Configuration

Route enhancer

Import route enhancer by adding following line on bottom of your site config.yaml .

imports:
  - { resource: "EXT:t3api/Configuration/Routing/config.yaml" }
Copied!

If you do not want to use import you can also manually add new route enhancer of type T3apiResourceEnhancer directly in your site configuration.

routeEnhancers:
  T3api:
    type: T3apiResourceEnhancer
Copied!

Default base path to api requests is: _api. To change it, it is needed to extend route enhancer configuration by basePath property, as in example below:

routeEnhancers:
  T3api:
    type: T3apiResourceEnhancer
    basePath: 'my_custom_api_basepath'
Copied!

Creating API resource

Next step is to make an API resource from our entity. To map Extbase model to API resource it is just needed to add @SourceBroker\T3api\Annotation\ApiResource annotation to our model class.

use SourceBroker\T3api\Annotation\ApiResource;

/**
 * @ApiResource()
 */
class Item extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
}
Copied!