GeneratedAssets
class GeneratedAssets implements GeneratedAssetHandler (View source)
Simple Flysystem implementation of GeneratedAssetHandler for storing generated content
Properties
protected | Filesystem | $assetStore | Flysystem store for files |
Methods
Assign the asset backend. This must be a filesystem with an adapter of type {PublicAdapter}.
Returns a URL to a generated asset, if one is available.
Returns the content for a generated asset, if one is available.
Check if the file exists or that the $callback provided was able to regenerate it.
Details
$this
setFilesystem(Filesystem $store)
Assign the asset backend. This must be a filesystem with an adapter of type {PublicAdapter}.
Filesystem
getFilesystem()
Get the asset backend
string
getContentURL(string $filename, callable $callback = null)
Returns a URL to a generated asset, if one is available.
Given a filename, determine if a file is available. If the file is unavailable, and a callback is supplied, invoke it to regenerate the content.
string
getContent(string $filename, callable $callback = null)
Returns the content for a generated asset, if one is available.
Given a filename, determine if a file is available. If the file is unavailable, and a callback is supplied, invoke it to regenerate the content.
protected bool
checkOrCreate(string $filename, callable $callback = null)
Check if the file exists or that the $callback provided was able to regenerate it.
setContent(string $filename, string $content)
Update content with new value
removeContent(string $filename)
Remove any content under the given file.
If $filename is a folder, it should delete all files underneath it also.