SlimServeAsset
Asset server for applications using Slim. Intended for development scenarios.
Requires an instance of AssetLoader to handle loading assets from filesystem or remote source.
Tags
Table of Contents
$assetLoader | AssetLoader | |
---|---|---|
__construct() | Constructor. | mixed |
serveAsset() | Reverses prefix transformations, locates asset via locator and adds asset content to response. | mixed |
Properties
$assetLoader
protected
AssetLoader
$assetLoader
Methods
__construct()
Constructor.
public
__construct(
$assetLoader :
AssetLoader
)
: mixed
Parameters
- $assetLoader : AssetLoader
The asset loader instance
Return values
mixedserveAsset()
Reverses prefix transformations, locates asset via locator and adds asset content to response.
public
serveAsset(
$request :
RequestInterface
, $response :
ResponseInterface
, $args :
array
)
: mixed
On failure, sets response status code to 404. To use, simply hook up to routing with the necessary relative url passed through at 'url'. NOTE: PHP is very inefficent when it comes to serving static assets, and as such this is only recommended for testing purposes.
Parameters
- $request : RequestInterface
- $response : ResponseInterface
- $args : array