PHP Класс MiniAsset\Middleware\AssetMiddleware

This provides a development grade middleware component that can serve the assets that mini-asset could build. This component is *not* recommended for production as it will be much slower than serving the static files generated by the CLI tool.
Показать файл Открыть проект

Открытые методы

Метод Описание
__construct ( AssetConfig $config, string $outputDir = null, string $urlPrefix = '/asset/' ) Constructor.
__invoke ( Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response, callable $next ) : Psr\Http\Message\ResponseInterface Apply the asset middleware.

Приватные методы

Метод Описание
mapType ( $ext )
respond ( $response, $contents, $ext )

Описание методов

__construct() публичный Метод

Constructor.
public __construct ( AssetConfig $config, string $outputDir = null, string $urlPrefix = '/asset/' )
$config MiniAsset\AssetConfig The config instance for your application.
$outputDir string The directory development build caches should be stored in. Defaults to sys_get_temp_dir().
$urlPrefix string The URL prefix that assets are under. Defaults to /asset/.

__invoke() публичный Метод

Apply the asset middleware.
public __invoke ( Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response, callable $next ) : Psr\Http\Message\ResponseInterface
$request Psr\Http\Message\ServerRequestInterface The request.
$response Psr\Http\Message\ResponseInterface The response.
$next callable The callable to invoke the next middleware layer.
Результат Psr\Http\Message\ResponseInterface A response.