nfreear/http-file-dispatcher

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

Installs: 43

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 1

Open Issues: 3

pkg:composer/nfreear/http-file-dispatcher

1.2.2 2021-07-07 11:28 UTC

This package is not auto-updated.

Last update: 2025-10-10 04:10:27 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.