Statistics
10
0
48d
Badges
Tags
api

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.

  • 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! :goberserk:

    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! 🚳

    v0.2...v0.2.1

    Changes:

    • strickness ApiRouter matching
  • 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)
      • ApiEmitter (passes requests to ApiDispatcher)
      • synchronize trailing slashes (at the start, at the end)
  • v0.1 v0.1

    First bump! 👊

Is this addon outdated? Did you find an issue? Please report it.

Componette Componette admin@componette.com