PHPackages                             dfau/toujou-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. dfau/toujou-api

ActiveTypo3-cms-extension[API Development](/categories/api)

dfau/toujou-api
===============

TYPO3 REST API Framework

v2.1.0(3y ago)69.0k[2 PRs](https://github.com/DFAU/toujou-api/pulls)GPL-3.0-or-laterPHPPHP &gt;=7.2 &lt;7.5CI passing

Since Nov 12Pushed 1w ago6 watchersCompare

[ Source](https://github.com/DFAU/toujou-api)[ Packagist](https://packagist.org/packages/dfau/toujou-api)[ RSS](/packages/dfau-toujou-api/feed)WikiDiscussions main Synced today

READMEChangelog (7)Dependencies (16)Versions (16)Used By (0)

Toujou API
==========

[](#toujou-api)

REST API for TYPO3 CMS based on [{json:api}](https://jsonapi.org/)

Useful german youtube video [https://www.youtube.com/watch?v=WoOuNe\_rzpM](https://www.youtube.com/watch?v=WoOuNe_rzpM)

Installation
------------

[](#installation)

Require and install the plugin

```
$ composer require dfau/toujou-api
$ vendor/bin/typo3cms extension:install toujou_api

```

Configuration
-------------

[](#configuration)

To make the API work you have to do the following:

- Check *Sites Management* for api entrypoint
- Create a BE user with OAuth2 client\_id and client\_secrect (OAuth2 tab)
- Add and configure API resources (see [Resources.php](Configuration/ToujouApi/Resources.php))
- Add and configure API routes (see [Resources.php](Configuration/ToujouApi/Routes.php))

Security
--------

[](#security)

The API will be secured to prevent unwarranted requests.

You can obtain an access token by sending a POST request to `/_api/token` with following parameters:

keyvaluegrant\_typeclient\_credentialsclient\_id&lt;CLIENT\_ID&gt;client\_secret&lt;CLIENT\_SECRET&gt;Get auth token via request (Example):

```
curl --location --request POST 'https://rms.dfau.dev/_api/token' \
    --form 'grant_type="client_credentials"' \
    --form 'client_id="12fc7d65-0177-48be-9c3c-e7d8b2a1"' \
    --form 'client_secret="131"'
```

On valid credentials the json response will contain an access token:

```
{
  "token_type": "Bearer",
  "expires_in": 86400,
  "access_token": "eyJ0eXAiOiJ..."
}
```

For all following requests you need to use this access token by adding following line to the request header

```
Authorization : Bearer

```

Example requests:

```
curl --location --request GET 'https://rms.dfau.dev/_api/pages/' \
    --header 'Authorization: Bearer eyJ0eXAi....' \
```

Development
-----------

[](#development)

Install php dependencies using composer:

```
$ composer install

```

#### [PHPUnit](https://phpunit.de) Unit tests

[](#phpunit-unit-tests)

```
$ etc/scripts/runTests.sh

```

#### [PHPUnit](https://phpunit.de) Functional tests

[](#phpunit-functional-tests)

```
$ etc/scripts/runTests.sh -s functional

```

#### [Codeception](https://codeception.com/) Acceptance tests

[](#codeception-acceptance-tests)

```
$ etc/scripts/runTests.sh -s acceptance

```

#### [Easy-Coding-Standard](https://github.com/Symplify/EasyCodingStandard)

[](#easy-coding-standard)

Check coding standard violations

```
$ etc/scripts/checkCodingStandards.sh

```

Fix coding standard violations automatically

```
$ etc/scripts/checkCodingStandards.sh --fix

```

Documentation
-------------

[](#documentation)

Make `dockrun\_t3rd available in current terminal

```
source
