chubbyphp / chubbyphp-framework
A minimal, highly performant middleware PSR-15 microframework built with as little complexity as possible, aimed primarily at those developers who want to understand all the vendors they use.
Installs: 35 753
Dependents: 7
Suggesters: 0
Security: 0
Stars: 122
Watchers: 5
Forks: 4
Open Issues: 0
Requires
- php: ^8.2
- chubbyphp/chubbyphp-http-exception: ^1.1
- psr/container: ^1.1.2|^2.0.2
- psr/http-factory: ^1.1
- psr/http-factory-implementation: ^1.0
- psr/http-message: ^1.1|^2.0
- psr/http-message-implementation: ^1.0|^2.0
- psr/http-server-handler: ^1.0.2
- psr/http-server-middleware: ^1.0.2
- psr/log: ^2.0|^3.0.2
Requires (Dev)
- chubbyphp/chubbyphp-dev-helper: dev-master
- chubbyphp/chubbyphp-mock: ^1.8
- guzzlehttp/psr7: ^2.7
- http-interop/http-factory-guzzle: ^1.2
- infection/infection: ^0.29.8
- laminas/laminas-diactoros: ^3.5
- nyholm/psr7: ^1.8.2
- php-coveralls/php-coveralls: ^2.7.0
- phpstan/extension-installer: ^1.4.3
- phpstan/phpstan: ^2.0.3
- phpunit/phpunit: ^11.5.0
- slim/psr7: ^1.7
- sunrise/http-message: ^3.2
- dev-master / 5.2.x-dev
- 5.2.0
- 5.1.1
- 5.1.0
- 5.0.3
- 5.0.2
- 5.0.1
- 5.0.0
- v4.x-dev
- 4.2.3
- 4.2.2
- 4.2.1
- 4.2.0
- 4.1.0
- 4.0.0
- v3.x-dev
- 3.6.2
- 3.6.1
- 3.6.0
- 3.5.1
- 3.5.0
- 3.4.1
- 3.4.0
- 3.3.0
- 3.2.0
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.0
- v2.x-dev
- 2.8.2
- 2.8.1
- 2.8.0
- 2.7.0
- 2.6.2
- 2.6.1
- 2.6.0
- 2.5.0
- 2.4.1
- 2.4.0
- 2.3.0
- 2.2.1
- 2.2.0
- 2.2-beta1
- 2.1.0
- 2.0.0
- 2.0-beta2
- 2.0-beta1
- v1.x-dev
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.1
- 1.1.0
- 1.0.0
- 1.0-beta3
- 1.0-beta2
- 1.0-beta1
- 1.0-alpha9
- 1.0-alpha8
- 1.0-alpha7
- 1.0-alpha6
- 1.0-alpha5
- 1.0-alpha4
- 1.0-alpha3
- 1.0-alpha2
- 1.0-alpha1
This package is auto-updated.
Last update: 2024-12-08 07:29:10 UTC
README
Description
A minimal, highly performant middleware PSR-15 microframework built with as little complexity as possible, aimed primarily at those developers who want to understand all the vendors they use.
- Basic Coding Standard (1)
- Coding Style Guide (2)
- Logger Interface (3)
- Autoloading Standard (4)
- HTTP Message Interface (7)
- Container Interface (11)
- HTTP Handlers (15)
- HTTP Factories (17)
Requirements
- php: ^8.2
- chubbyphp/chubbyphp-http-exception: ^1.1
- psr/container: ^1.1.2|^2.0.2
- psr/http-factory-implementation: ^1.0
- psr/http-factory: ^1.1
- psr/http-message-implementation: ^1.0|^2.0
- psr/http-message: ^1.1|^2.0
- psr/http-server-handler: ^1.0.2
- psr/http-server-middleware: ^1.0.2
- psr/log: ^2.0|^3.0.2
Suggest
Router
Any Router which implements Chubbyphp\Framework\Router\RouteMatcherInterface
can be used.
PSR 7 / PSR 17
- guzzlehttp/psr7: ^2.7 (with http-interop/http-factory-guzzle: ^1.2)
- laminas/laminas-diactoros: ^3.5
- nyholm/psr7: ^1.8.2
- slim/psr7: ^1.7
- sunrise/http-message: ^3.2
Installation
Through Composer as chubbyphp/chubbyphp-framework.
composer require chubbyphp/chubbyphp-framework "^5.2" \ chubbyphp/chubbyphp-framework-router-fastroute "^2.1" \ slim/psr7 "^1.7"
Usage
<?php declare(strict_types=1); namespace App; use Chubbyphp\Framework\Application; use Chubbyphp\Framework\Middleware\ExceptionMiddleware; use Chubbyphp\Framework\Middleware\RouteMatcherMiddleware; use Chubbyphp\Framework\RequestHandler\CallbackRequestHandler; use Chubbyphp\Framework\Router\FastRoute\RouteMatcher; use Chubbyphp\Framework\Router\Route; use Chubbyphp\Framework\Router\RoutesByName; use Psr\Http\Message\ServerRequestInterface; use Slim\Psr7\Factory\ResponseFactory; use Slim\Psr7\Factory\ServerRequestFactory; require __DIR__.'/vendor/autoload.php'; $responseFactory = new ResponseFactory(); $app = new Application([ new ExceptionMiddleware($responseFactory, true), new RouteMatcherMiddleware(new RouteMatcher(new RoutesByName([ Route::get('/hello/{name:[a-z]+}', 'hello', new CallbackRequestHandler( static function (ServerRequestInterface $request) use ($responseFactory) { $response = $responseFactory->createResponse(); $response->getBody()->write(sprintf('Hello, %s', $request->getAttribute('name'))); return $response; } )) ]))), ]); $app->emit($app->handle((new ServerRequestFactory())->createFromGlobals()));
Emitter
Middleware
- CallbackMiddleware
- ExceptionMiddleware
- LazyMiddleware
- MiddlewareDispatcher
- RouteMatcherMiddleware
- SlimCallbackMiddleware
- SlimLazyMiddleware
RequestHandler
- CallbackRequestHandler
- LazyRequestHandler
- RouteRequestHandler
- SlimCallbackRequestHandler
- SlimLazyRequestHandler
Router
Server
Skeleton
Migration
Copyright
2024 Dominik Zogg