Skip to content

nfreear/http-file-dispatcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A simple PHP library to serve static files & documents over HTTP/S via PHP (APPLAuD)

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages