Download the PHP package debuss-a/piccolo-framework without Composer
On this page you can find all versions of the php package debuss-a/piccolo-framework. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download debuss-a/piccolo-framework
More information about debuss-a/piccolo-framework
Files in debuss-a/piccolo-framework
Package piccolo-framework
Short Description The framework of the Piccolo skeleton: a PSR-15 application built on Laminas Stratigility and Mezzio components, with a scoped container, attribute-based routing, and FrankenPHP worker mode support.
License MIT
Informations about the package piccolo-framework
Piccolo Framework
The framework of the Piccolo skeleton: a PSR-15 application built on Laminas
Stratigility and Mezzio components (without mezzio/mezzio), with
a scoped container, attribute-based routing, and support for the
FrankenPHP worker mode.
What it provides
| Namespace | Content |
|---|---|
Piccolo\Kernel |
Boots the application: paths, configuration, environment, PHP settings, container |
Piccolo\Application |
The PSR-15 application: middleware pipeline, routes, one container scope per request |
Piccolo\Runtime |
SapiRunner (PHP-FPM, built-in server, ...) and FrankenPhpWorkerRunner, chosen automatically |
Piccolo\ServiceProvider |
HTTP factories (Diactoros), logger (Monolog), router (FastRoute), error handler, Problem Details, CORS, templates (Plates) |
Piccolo\Middleware |
RequestIdMiddleware, HttpCacheMiddleware, ApiAcceptHeaderMiddleware, LazyLoadingMiddleware |
Piccolo\Http |
Handler (base class of the request handlers), error logging, request identifier |
Piccolo\Console |
cache:clear, cache:warmup, routes:list |
Piccolo\Paths |
The directories of the application, and the helpers app_path(), config_path(), storage_path(), ... |
Application layout
The kernel expects this layout, from the root directory given to Kernel::boot():
The definitions of config/container.php are registered after the providers of the framework, so they can replace
them (another logger, another PSR-7 implementation with new HttpFactoryServiceProvider(...), ...).
Lifetimes and worker mode
| Lifetime | Framework services |
|---|---|
| Singleton | configuration, environment, paths, PSR-17 factories, logger, router and routing middlewares, pipeline, application, error handler, Problem Details, CORS, template renderer |
| Scoped | none: for the services of the application with a per-request state (unit of work, current user, ...) |
| Transient | the classes that are not registered: request handlers, middlewares, ... |
Each request is handled in its own scope: the middlewares and handlers piped or routed as class names are resolved from it, and the scope is disposed once the response is created.
When the script is run by a FrankenPHP worker (frankenphp_handle_request() exists and $_SERVER['FRANKENPHP_WORKER']
is set), the kernel is booted once, and the requests are handled in a loop. After each request, the singletons holding a
state are reset (Monolog buffers and processors, the request identifier, ...) and the garbage collector runs. The worker
stops after MAX_REQUESTS requests (unlimited by default) so that FrankenPHP restarts it.
Rule of thumb in a worker: never keep a request state in a singleton: make the service scoped, or reset it (implement
Piccolo\Container\Resettable, or register a hook with $builder->onReset()).
Tests
All versions of piccolo-framework with dependencies
borschphp/config Version ^1.4
debuss-a/attribute-routing Version ^3.0
debuss-a/awareness Version ^1.2
debuss-a/piccolo-container Version ^0.1
debuss-a/server-request-factory Version ^1.0
laminas/laminas-diactoros Version ^3.8
laminas/laminas-httphandlerrunner Version ^2.13
laminas/laminas-stratigility Version ^4.3
league/plates Version ^3.6
mezzio/mezzio-cors Version ^1.16
mezzio/mezzio-fastroute Version ^3.14
mezzio/mezzio-helpers Version ^5.20
mezzio/mezzio-platesrenderer Version ^2.14
mezzio/mezzio-problem-details Version ^1.19
mezzio/mezzio-router Version ^4.2
mezzio/mezzio-template Version ^3.0
monolog/monolog Version ^3.10
psr/container Version ^2.0
psr/http-factory Version ^1.1
psr/http-message Version ^2.0
psr/http-server-handler Version ^1.0
psr/http-server-middleware Version ^1.0
psr/log Version ^3.0
symfony/console Version ^8.1