Skip to content

Latest commit

 

History

History
41 lines (25 loc) · 1023 Bytes

README.md

File metadata and controls

41 lines (25 loc) · 1023 Bytes

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) {
    $response = new JsonResponse(['message' => 'Hello World!']);
    $ctx->setResponse($response);
});

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