Releases: Attributes-PHP/wp-fastendpoints
Releases · Attributes-PHP/wp-fastendpoints
v4.0.0
v3.1.1
v3.1.0
- Adds support for error handling via
onExceptionfunction
// Type what you need
$router->onException(CustomException::class, function (UserNotFoundException $e) {
return new WpError(404, $e->getMessage());
);
$router->get('/user', function () {
throw new UserNotFoundException('My custom exception');
});v3.0.1
v3.0.0
v2.1.1
v2.1.0
- Adds support for router dependencies
- Adds dependencies support for native WP REST endpoints by passing dependencies via argument
$router = new Router('api', 'v1');
$router->depends('buddypress'); // Global dependency across all sub-routers/endpoints// Support for native WP REST endpoints
$args = [
'methods' => 'GET',
'depends' => ['buddypress'],
...
];
register_rest_route('api/v1', 'custom-endpoint', $args);v2.0.0
- Changed variable special vars from {ID} to <ID> to keep consistency
- Specifying endpoint plugin dependencies. This feature by its own doesn't do anything but if the WP-FastEndpoints-Depends plugin is active it does speed up your endpoints 😊
$router->get('(?P<postId>[\d]+)', function ($postId) {
return get_post($postId);
})
->hasCap('edit_post', '<ID>')
// With WP-FastEndpoints-Depends it only loads the buddypress plugin
->depends('buddypress');v1.2.2
- Added three new filter hooks to allow the customisation of the JSON schema validator:
- fastendpoints_validator - Triggered by all validators e.g. schema and response
- fastendpoints_schema_validator - Triggered only by the request schema validator
- fastendpoints_response_validator - Triggered only by the response schema validator
v1.2.1
- Taking advantage of schema loader and resolver from json/opis instead of custom one