Contributte/API -> Apitte
PSR-7
, REST
, Relay
, Middleware
, GraphQL
, DataQL
, Annotations
) for Nette Framework
.
Contributte
Apitte
Migration
Everything is pretty much same except (
#1 Install
Before
composer require contributte/api
After
There are more features and more packages. Just check it out.
composer require apitte/core
composer require apitte/debug
composer require apitte/mapping
composer require apitte/middlewares
composer require apitte/mapping
composer require apitte/openapi
#2 Usage
namespace App\Controllers;
use Contributte\Api\Annotation\Controller\Controller;
use Contributte\Api\Annotation\Controller\Method;
use Contributte\Api\Annotation\Controller\Path;
use Contributte\Api\Annotation\Controller\RootPath;
use Contributte\Api\Http\ApiRequest;
use Contributte\Api\Http\ApiResponse;
use Contributte\Api\UI\Controller\IController;
/**
* @Controller
* @RootPath("/hello")
*/
final class HelloController implements IController
{
/**
* @Path("/world")
* @Method("GET")
* @param ApiRequest $request
* @param ApiResponse $response
* @return ApiResponse
*/
public function index(ApiRequest $request, ApiResponse $response)
{
return $response->writeBody('Hello world!');
}
}
After
namespace App\Controllers;
use Apitte\Core\Annotation\Controller\Controller;
use Apitte\Core\Annotation\Controller\Method;
use Apitte\Core\Annotation\Controller\Path;
use Apitte\Core\Annotation\Controller\RootPath;
use Apitte\Core\Http\ApiRequest;
use Apitte\Core\Http\ApiResponse;
use Apitte\Core\UI\Controller\IController;
/**
* @Controller
* @RootPath("/hello")
*/
final class HelloController implements IController
{
/**
* @Path("/world")
* @Method("GET")
*/
public function index(ApiRequest $request, ApiResponse $response)
{
return $response->writeBody('Hello world!');
}
}
Thank you for understanding. We would like to make API event better.
-
v0.3 v0.3
Bump!
🔪 Diff: v0.2.2...v0.3
Changes:
- namespace refactoring (drop Bridges)
- rename Factory/Generator to Serialization
- rename Validators to Validations
- ApiResponse/ApiRequest don't composite PSR7, they extend
- simplify whole middlewares usage
- simplify ApiExtension
- added new Api2MiddlewaresExtension to easy use of middlewares
- simplify Transformers (from 2 interfaces to 1 interface)
- direct dependencies: contributte/psr7-http-message, contributte/middlewares, contributte/phpdoc
- tiny micro refactorings
- added huge amount of tests
-
v0.2.2 v0.2.2
Bump!
Diff: v0.2.1...v0.2.2
Changes:
- added schema validators [#1] [#2]
- analyse via phpstan [#10]
- added content negotiation
- many small improvements
-
v0.2.1 v0.2.1
Bump!
🚳 Changes:
- strickness
ApiRouter
matching
- strickness
-
v0.2 v0.2
Bumped!
🐕 Diff: v0.1...v0.2
Changes:
- rewritten ApiMiddleware (BC!)
- introduced invokers concept:
- ApiRouter (
maps and parses request URL(s)
) - ApiContentNegotiation (
converts data to any formats
)- UrlNegotiator (
negotiates content data by URL suffix
)- JsonTransformer (
encodes / decodes data
)
- JsonTransformer (
- UrlNegotiator (
- ApiEmitter (
passes requests to ApiDispatcher
) - synchronize trailing slashes (at the start, at the end)
- ApiRouter (
-
v0.1 v0.1
First bump!
👊