Library to easily expose REST APIs

7.0.0 2019-01-11 20:06 UTC


master develop
Scrutinizer Code Quality Scrutinizer Code Quality
Code Coverage Code Coverage
Build Status Build Status

This library contains a set of tools to define, validate, extract and expose resources through http in a REST manner.


Via composer:

composer require innmind/rest-server


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 deinfitions you provided

// action controllers
// controller to output the resource definition
// controller to expose links to all the resources definitions

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.