chubbyphp / chubbyphp-framework-router-aura
This package is abandoned and no longer maintained.
The author suggests using the chubbyphp/chubbyphp-framework-fastroute package instead.
aura router implementation for chubbyphp-framework.
2.0.0
2022-10-02 19:15 UTC
Requires
- php: ^8.0
- aura/router: ^3.1
- chubbyphp/chubbyphp-framework: ^5.0.3
- chubbyphp/chubbyphp-http-exception: ^1.0.1
- psr/http-message: ^1.0.1
Requires (Dev)
- bittyphp/http: ^2.0
- chubbyphp/chubbyphp-dev-helper: dev-master
- chubbyphp/chubbyphp-mock: ^1.6.1
- guzzlehttp/psr7: ^1.4.2
- http-interop/http-factory-guzzle: ^1.0
- infection/infection: ^0.26.5
- laminas/laminas-diactoros: ^2.0
- nyholm/psr7: ^1.0
- php-coveralls/php-coveralls: ^2.5.2
- phploc/phploc: ^7.0.2
- phpstan/extension-installer: ^1.1
- phpstan/phpstan: ^1.4.6
- phpunit/phpunit: ^9.5.16
- slim/psr7: ^0.5|^1.0
- sunrise/http-factory: ^1.0.4
README
Description
Aura Router implementation for chubbyphp-framework.
DEPRECATED: I suggest to use chubbyphp-framework-router-fastroute.
Requirements
- php: ^8.0
- aura/router: ^3.1
- chubbyphp/chubbyphp-framework: ^5.0.3
- chubbyphp/chubbyphp-http-exception: ^1.0.1
- psr/http-message: ^1.0.1
Installation
Through Composer as chubbyphp/chubbyphp-framework-router-aura.
composer require chubbyphp/chubbyphp-framework-router-aura "^2.0"
Usage
<?php declare(strict_types=1); namespace App; use Chubbyphp\Framework\Application; use Chubbyphp\Framework\Middleware\ExceptionMiddleware; use Chubbyphp\Framework\Middleware\RouterMiddleware; use Chubbyphp\Framework\RequestHandler\CallbackRequestHandler; use Chubbyphp\Framework\Router\Aura\Router; use Chubbyphp\Framework\Router\Route; use Psr\Http\Message\ServerRequestInterface; use Slim\Psr7\Factory\ResponseFactory; use Slim\Psr7\Factory\ServerRequestFactory; $loader = require __DIR__.'/vendor/autoload.php'; $responseFactory = new ResponseFactory(); $app = new Application([ new ExceptionMiddleware($responseFactory, true), new RouterMiddleware(new Router([ Route::get('/hello/{name}', 'hello', new CallbackRequestHandler( function (ServerRequestInterface $request) use ($responseFactory) { $name = $request->getAttribute('name'); $response = $responseFactory->createResponse(); $response->getBody()->write(sprintf('Hello, %s', $name)); return $response; } ), [], [Router::PATH_TOKENS => ['name' => '[a-z]+']]) ])), ]); $app->emit($app->handle((new ServerRequestFactory())->createFromGlobals()));
Copyright
2023 Dominik Zogg