Skip to content

contributte/api

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 

Contributte/API -> Apitte

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