nfreear/http-file-dispatcher

A simple library to serve static image files & documents over HTTP/S via PHP. | © Nick Freear (IET-OU).

1.2.2 2021-07-07 11:28 UTC

This package is not auto-updated.

Last update: 2024-10-24 23:09:09 UTC


README

PHP Composer

http-file-dispatcher

A simple library to serve static image files & documents over HTTP/S via PHP.

composer require nfreear/http-file-dispatcher

Example

An OctoberCMS frontend plugin:

use Nfreear\HttpFileDispatcher\FileDispatcher;

class Plugin extends PluginBase
{
    // ...

    public function boot()
    {
        // ...

        App::before(function () {

            FileDispatcher::debug(__METHOD__);

            $dispatcher = new FileDispatcher();

            $dispatcher->setUriRequestPrefix('/file?f=');

            $dispatcher->setFilePath(__DIR__ . '/../../../themes/applaud/content/static-pages/files/');

            $dispatcher->run();
        });

        // ...
    }

    // ...
}

License

  • License: MIT
  • Original Gist.