Endpoints
Introduction
Endpoints represent your path relative to the Collections or Resources it's attached to. Allowed roles applied to it's Collection or Resource as well as the expected POST
data format can be overriden.
use Prest\Api;
use Acme\Acl\Roles;
use Prest\Api\Endpoint;
use Prest\Api\Collection;
use Acme\Controller\Auth\LoginController;
$api = new Api();
$api->collection(Collection::factory('auth')
->handler(LoginController::class)
->allow(Roles::UNAUTHORIZED)
->endpoint(Endpoint::post('/login', 'login'))
);s
This example provides you with a POST
endpoint with /auth/login
as path. The login
method on LoginController
will be used to handle this endpoint.