2017 © Pedro Peláez
 

library staticfiles-middleware

This is a StackPHP middleware for phramz/staticfiles webserver

image

phramz/staticfiles-middleware

This is a StackPHP middleware for phramz/staticfiles webserver

  • Sunday, August 2, 2015
  • by Maximilian Reichel
  • Repository
  • 1 Watchers
  • 0 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Static Files StackPHP Middleware

Build Status Scrutinizer Code Quality Code Coverage SensioLabsInsight, (*1)

This is a StackPHP middleware for the phramz/staticfile webserver (https://github.com/phramz/staticfiles), (*2)

Install

Install with Composer:, (*3)

$ curl -sS https://getcomposer.org/installer | php
$ php composer.phar require phramz/staticfiles-middleware

Example

<?php

use Symfony\Component\HttpFoundation\Request;

// your static files will be served from this folder
$webroot = '/var/www';

// if we cannot guess the files mime-type we'll use this default
$defaultMimetype = 'application/octed-stream';

// files with the following extensions will not be delivered. We'll get a 404 instead.
$exclude = ['php', 'key'];

// if true requests to non existing ressources will be passed to the next app in stack.
// if false the middleware will return a 404 response
$ignoreNotFound = true;

// create your application ... whatever it is e.g. Silex, Symfony2 etc.
$app = new Application();

// build the stack
$app = (new Stack\Builder())
    ->push(
        'Phramz\Staticfiles\Middleware\HttpServer', 
        $webroot, 
        $defaultMimetype, 
        $exclude,
        $ignoreNotFound
    )
    ->resolve($app);

// dispatch the request
$request = Request::createFromGlobals();

$response = $app->handle($request);
$response->send();

// and shutdown
$app->terminate($request, $response);

LICENSE

This project is under MIT license. Please read the LICENSE file for further information., (*4)

Credits

Some of the 3rd party libraries in use:, (*5)

  • https://github.com/stackphp
  • https://github.com/symfony
  • https://github.com/webmozart
  • https://github.com/phpunit

The Versions

02/08 2015

dev-master

9999999-dev

This is a StackPHP middleware for phramz/staticfiles webserver

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Maximilian Reichel

middleware stack stackphp webserver staticfiles

02/08 2015

v1.0.0

1.0.0.0

This library will serve static files from a local directory

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Maximilian Reichel

middleware stack stackphp webserver staticfiles