PHP Class 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.
显示文件
Open project: markstory/mini-asset
Public Methods
Method |
Description |
|
__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. |
|
Private Methods
Method |
Description |
|
mapType ( $ext ) |
|
|
respond ( $response, $contents, $ext ) |
|
|
Method Details
__construct()
public method
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/. |
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. |
return |
Psr\Http\Message\ResponseInterface |
A response. |