This package is abandoned and no longer maintained. The author suggests using the apitte/core package instead.

Powerfull API [REST/Relay/Middleware/GraphQL/DataQL] for Nette Framework

v0.3 2017-08-11 14:33 UTC

This package is auto-updated.

Last update: 2021-03-12 22:44:19 UTC


README

💥 Powerful API (PSR-7, REST, Relay, Middleware, GraphQL, DataQL, Annotations) for Nette Framework.

❗ This project is discontinued.

👍 It has been moved under Apitte organization and split into more repositories (⚡).

Contributte

Join the chat

Apitte

Join the chat

Migration

Everything is pretty much same except (⚠️) namespaces.

#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.