phramz / staticfiles-middleware
This package is abandoned and no longer maintained.
No replacement package was suggested.
This is a StackPHP middleware for phramz/staticfiles webserver
v1.0.0
2015-08-01 23:16 UTC
Requires
- php: >=5.5.9
- phramz/staticfiles: ^1.0.2
- psr/log: ~1.0
- symfony/http-foundation: ~2.1
- symfony/http-kernel: ~2.1
Requires (Dev)
- phpunit/phpunit: ~4.1
- symfony/var-dumper: ~2.6
This package is not auto-updated.
Last update: 2023-09-02 11:40:14 UTC
README
This is a StackPHP middleware for the phramz/staticfile
webserver (https://github.com/phramz/staticfiles)
Install
Install with Composer:
$ 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.
Credits
Some of the 3rd party libraries in use: