apitte/core

Core API library in Apitte stack

v0.1 2017-11-23 12:47 UTC

README

🔧 Core API library for Nette Framework.

Build Status Code coverage Licence

Downloads this Month Downloads total Latest stable

Discussion / Help

Join the chat

Install

composer require apitte/core

Version

State Version Branch PHP Composer
development ~0.2.0 master >= 5.6 minimum-stability: dev, prefer-stable: true
stable ~0.1.0 master >= 5.6

Example

Just define some endpoints, I mean controllers. Place some annotations and thats all.

namespace App\Controllers;

use Apitte\Core\Annotation\Controller\Controller;
use Apitte\Core\Annotation\Controller\ControllerPath;
use Apitte\Core\Annotation\Controller\Method;
use Apitte\Core\Annotation\Controller\Path;
use Apitte\Core\Http\ApiRequest;
use Apitte\Core\Http\ApiResponse;
use Apitte\Core\UI\Controller\IController;

/**
 * @Controller
 * @ControllerPath("/hello")
 */
final class HelloController implements IController
{

    /**
     * @Path("/world")
     * @Method("GET")
     */
    public function index(ApiRequest $request, ApiResponse $response)
    {
        return $response->writeBody('Hello world!');
    }
}

And register your controller as service.

services:
    - App\Controllers\HelloController

As you can see, the architecture is ultra simple. ApiRequest & ApiResponse wrap PSR-7, so you can re-use these declared methods.

Overview

Maintainers

538058?v=3&s=150
Milan Felix Šulc

68747470733a2f2f63646e2e7261776769742e636f6d2f66336c31782f78736f757263652f32343633656662372f6173736574732f746c61706465762e706e67

The development is sponsored by Tlapnet and a lot of coffeees. Thank you guys! 👍

Thank you for testing, reporting and contributing.