Fr3nch13/CakePHP Utilities

AssetMiddleware
in package
implements MiddlewareInterface

Handles serving plugin assets in development mode.

This should not be used in production environments as it has sub-optimal performance when compared to serving files with a real webserver.

Table of Contents

Interfaces

MiddlewareInterface
Participant in processing a server request and response.

Properties

$cacheTime  : string
The amount of time to cache the asset.

Methods

__construct()  : mixed
Constructor.
process()  : ResponseInterface
Serve assets if the path matches one.
_getAssetFile()  : string|null
Builds asset file path based off url
deliverAsset()  : Response
Sends an asset file to the client
isNotModified()  : bool
Check the not modified header.

Properties

$cacheTime

The amount of time to cache the asset.

protected string $cacheTime = '+1 day'

Methods

__construct()

Constructor.

public __construct([array<string, mixed> $options = [] ]) : mixed
Parameters
$options : array<string, mixed> = []

The options to use

_getAssetFile()

Builds asset file path based off url

protected _getAssetFile(string $url) : string|null
Parameters
$url : string

Asset URL

Return values
string|null

Absolute path for asset file, null on failure


        
On this page

Search results