Contributte Api
# Contributte/API -> Apitte
💥 Powerful API (PSR-7
, REST
, Relay
, Middleware
, GraphQL
, DataQL
, Annotations
) for Nette Framework
(opens new window).
❗️ This project is discontinued.
👍 It has been moved under Apitte (opens new window) organization and split into more repositories (⚡️).
# Contributte
# Apitte
# Migration
Everything is pretty much same except (⚠️) namespaces.
# #1 Install
Before
composer require contributte/api
1
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
1
2
3
4
5
6
2
3
4
5
6
# #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!');
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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!');
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Thank you for understanding. We would like to make API event better.