innmind / rest-server
This package is abandoned and no longer maintained.
No replacement package was suggested.
Library to easily expose REST APIs
8.1.0
2021-02-13 15:00 UTC
Requires
- php: ~7.4|~8.0
- innmind/filesystem: ~4.0
- innmind/http: ~4.2
- innmind/immutable: ~3.5
- innmind/json: ^1.0
- innmind/specification: ~2.0
- innmind/url-template: ~2.0
- willdurand/negotiation: ^3.0
Requires (Dev)
- innmind/black-box: ^4.16
- innmind/coding-standard: ^1.1
- innmind/time-continuum: ~2.2
- phpunit/phpunit: ~9.0
- vimeo/psalm: ~4.4
Suggests
- innmind/time-continuum: In order to use point in time type
- dev-develop
- 8.1.0
- 8.0.0
- 7.0.0
- 6.1.1
- 6.1.0
- 6.0.0
- 5.0.0
- 4.0.0
- 3.1.3
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.0
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-master
- dev-dependabot/composer/giorgiosironi/eris-tw-0.10.0or-tw-0.11.0
- dev-dependabot/composer/phpunit/phpunit-approx-7.0or-approx-8.0
This package is auto-updated.
Last update: 2023-01-11 18:02:48 UTC
README
This library contains a set of tools to define, validate, extract and expose resources through http in a REST manner.
Installation
Via composer:
composer require innmind/rest-server
Usage
use function Innmind\Rest\Server\bootstrap; use Innmind\Rest\Server\Gateway; use Innmind\Immutable\Map; $services = bootstrap( new Map('string', Gateway::class), require '/path/to/resources/mapping.php' ); $services['routes']; // provides all the routes available for the definitions you provided // action controllers $services['controller']['create']; $services['controller']['index']; $services['controller']['get']; $services['controller']['remove']; $services['controller']['update']; $services['controller']['link']; $services['controller']['unlink']; // controller to output the resource definition $services['controller']['options']; // controller to expose links to all the resources definitions $services['controller']['capabilities'];
The gateways are the bridges between this component and your domain. The definition handling which resource is handled by which gateway is done in the resources mapping where a resource can only be managed by one gateway. Take a look at fixtures/mapping.php
to understand how to define your resources.