The goal of this framework is to enable us to quickly bootstrap new RESTful Services while sticking to our very strict coding guidelines. This especially means that any kind of magic should be avoided.
- Provides a
Pattern
that can be matches against anURI
- Supports HTTP verbs by implementing interfaces like
SupportsGetRequests
- Returns
Action
objects through explicit methods likegetPostCommand()
orgetQuery()
- Holds references to all
RestResource
objects it is responsible for - Determines if it is responsible for routing a given URL in
canRoute()
- Returns a
RestResource
indoRoute()
- Changes the state of a resource (like creating or updating)
- Does not change the state of a resource and only returns existing data.
- Composer
- PHP 7.0+
"require": {
"kartenmacherei/rest-framework": "dev-master"
}
// create a request
$request = Request::fromSuperGlobals();
// create a new instance of the framework
$framework = Framework::createInstance();
// register a RestResource Router
$framework->registerResourceRouter(new BasketResourceRouter());
// let the framework process the request
$response = $framework->run($request);
// send the response to the client
$response->flush();
See https://github.com/kartenmacherei/rest-framework-example for a working example.
This software is licensed under the terms of the MIT license. See LICENSE.md for the full license.