chubbyphp / chubbyphp-static-file
A minimal static file middleware for PSR 15.
Installs: 84
Dependents: 2
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 2
Open Issues: 0
pkg:composer/chubbyphp/chubbyphp-static-file
Requires
- php: ^8.1
- psr/http-factory: ^1.0.2
- psr/http-message: ^1.1|^2.0
- psr/http-server-handler: ^1.0.2
- psr/http-server-middleware: ^1.0.2
Requires (Dev)
- chubbyphp/chubbyphp-dev-helper: dev-master
- chubbyphp/chubbyphp-mock: ^1.6.1
- infection/infection: ^0.27.8
- php-coveralls/php-coveralls: ^2.7.0
- phpstan/extension-installer: ^1.3.1
- phpstan/phpstan: ^1.10.45
- phpunit/phpunit: ^10.4.2
This package is auto-updated.
Last update: 2025-09-30 05:59:11 UTC
README
Description
A minimal static file middleware for PSR 15.
Requirements
- php: ^8.2
- psr/http-factory: ^1.0.2
- psr/http-message: ^1.1|^2.0
- psr/http-server-handler: ^1.0.2
- psr/http-server-middleware: ^1.0.2
Installation
Through Composer as chubbyphp/chubbyphp-static-file.
composer require chubbyphp/chubbyphp-static-file "^1.4"
Usage
<?php declare(strict_types=1); namespace App; use Chubbyphp\StaticFile\StaticFileMiddleware; use Psr\Http\Message\ResponseFactoryInterface; use Psr\Http\Message\StreamFactoryInterface; /** @var ResponseFactoryInterface $responseFactory */ $responseFactory = ...; /** @var StreamFactoryInterface $streamFactory */ $streamFactory = ...; $app = ...; // add the static file middleware before the routing your PSR15 based framework $app->add(new StaticFileMiddleware( $responseFactory, $streamFactory, __DIR__ . '/public' ));
Copyright
2025 Dominik Zogg