kanellov/assets-manager-middleware

用于从非公开目录中提供资源的中间件

1.0.3 2016-03-07 09:41 UTC

This package is not auto-updated.

Last update: 2024-09-14 19:14:41 UTC


README

用于从非公开目录中提供资源的中间件

需求

  • php >= 5.5
  • psr/http-message

安装

$ composer require kanellov/assets-manager-middleware

示例

使用Slim框架中的中间件。

<?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();

许可证

assets-manager-middleware遵循GNU通用公共许可证版本3。有关更多信息,请参阅许可证文件