kanellov/assets-manager-middleware

A middleware to serve assets from non public directories

1.0.3 2016-03-07 09:41 UTC

This package is not auto-updated.

Last update: 2024-12-21 20:25:00 UTC


README

A middleware to serve assets from non public directories

Requirements

  • php >= 5.5
  • psr/http-message

Installation

$ composer require kanellov/assets-manager-middleware

Example

Using middleware with Slim Framework.

<?php 

chdir(dirname(__FILE__));

require 'vendor/autoload';

$app = new \Slim\App([
    'assets' => [
        'paths' => [
            'some/path',
        ],
        'web_dir' => __DIR__ . '/assets',
    ],
]);

$container = $app->getContainer();

// Register assets-manager-middleware in dependecy container
$container['assets'] = function ($c) {
    $settings = $c->get('settings');
    $config   = $settings['assets'];
    return new \Knlv\Middleware\AssetsManager($config);
};

// add middleware
$app->add('assets');

$app->run();

License

The assets-manager-middleware is licensed under the GNU GENERAL PUBLIC LICENSE Version 3. See License File for more information.