chubbyphp/chubbyphp-static-file
A minimal static file middleware for PSR 15.
dev-master / 1.0.x-dev
2019-12-10 16:58 UTC
Requires
- php: ^7.2
- psr/http-factory: ^1.0.1
- psr/http-message: ^1.0.1
- psr/http-server-handler: ^1.0.1
- psr/http-server-middleware: ^1.0.1
Requires (Dev)
- mavimo/phpstan-junit: ^0.2.3
- phploc/phploc: ^5.0
- chubbyphp/chubbyphp-mock: ^1.4.2
- phpstan/extension-installer: ^1.0.3
- phpstan/phpstan: ^0.11.19
- php-coveralls/php-coveralls: ^2.2
- phpunit/phpunit: ^8.4.3
- friendsofphp/php-cs-fixer: ^2.16.1
- infection/infection: ^0.14.3
- nunomaduro/phpinsights: ^1.11
This package is auto-updated.
Last update: 2019-12-10 16:59:04 UTC
README
Description
A minimal static file middleware for PSR 15.
Requirements
- php: ^7.2
- psr/http-factory: ^1.0.1
- psr/http-message: ^1.0.1
- psr/http-server-handler: ^1.0.1
- psr/http-server-middleware: ^1.0.1
Installation
Through Composer as chubbyphp/chubbyphp-static-file.
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
Dominik Zogg 2019