alexpts/next2

Micro application for PSR-7


Keywords
routing, micro, router, middleware, app, psr-7
License
MIT

Documentation

Next2

phpunit codecov

High performance mico framework

Install

composer require alexpts/next2

Docs

http://alexpts.github.io/php-next2-docs/

Hello World

<?php

use PTS\Next2\Context\ContextInterface;
use PTS\Next2\MicroApp;
use PTS\Psr7\Response\JsonResponse;
use PTS\Psr7\ServerRequest;
use PTS\Psr7\Uri;

require_once './vendor/autoload.php';

$psr7Request = new ServerRequest('GET', new Uri('/'));

$app = new MicroApp;

$app->store->get('/', function(ContextInterface $ctx) {
    $ctx->response = new JsonResponse(['message' => 'Hello World!']);
});

$psr7Response = $app->handle($psr7Request); // psr-15 runner