Skip to content

mavimo/chubbyphp-static-file

 
 

Repository files navigation

chubbyphp-static-file

Build Status Coverage Status Latest Stable Version Total Downloads Monthly Downloads Daily Downloads

Description

A minimal static file middleware for PSR 15.

Requirements

Installation

Through Composer as chubbyphp/chubbyphp-static-file.

composer require chubbyphp/chubbyphp-static-file "^1.0"

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 2020

About

A minimal static file middleware for PSR 15.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages

  • PHP 100.0%