Packages::getPackage()

PackageInterface getPackage(string $name = null) Returns an asset package. Parameters string $name The name of the package or null for the default package Return Value PackageInterface An asset package Exceptions InvalidArgumentException If there is no package by that name LogicException If no default package is defined

Packages::addPackage()

addPackage(string $name, PackageInterface $package) Adds a package. Parameters string $name The package name PackageInterface $package The package

Packages

class Packages Helps manage asset URLs. Methods __construct(PackageInterface $defaultPackage = null, array $packages = array()) setDefaultPackage(PackageInterface $defaultPackage) Sets the default package. addPackage(string $name, PackageInterface $package) Adds a package. PackageInterface getPackage(string $name = null) Returns an asset package. string getVersion(string $path, string $packageName = null) Gets the version to add to public URL. string getUrl(stri

PackageInterface::getVersion()

string getVersion(string $path) Returns the asset version for an asset. Parameters string $path A path Return Value string The version string

PackageInterface::getUrl()

string getUrl(string $path) Returns an absolute or root-relative public path. Parameters string $path A path Return Value string The public path

PackageInterface deprecated::getVersion()

string getVersion() Returns the asset package version. Return Value string The version string

PackageInterface deprecated::getUrl()

string getUrl(string $path, string|bool|null $version = null) Returns an absolute or root-relative public path. Parameters string $path A path string|bool|null $version A specific version for the path Return Value string The public path

PackageInterface deprecated

interface PackageInterface deprecated since 2.7, will be removed in 3.0. Use the Asset component instead. Asset package interface. Methods string getVersion() Returns the asset package version. string getUrl(string $path, string|bool|null $version = null) Returns an absolute or root-relative public path. Details string getVersion() Returns the asset package version. Return Value string The version string str

PackageInterface

interface PackageInterface Asset package interface. Methods string getVersion(string $path) Returns the asset version for an asset. string getUrl(string $path) Returns an absolute or root-relative public path. Details string getVersion(string $path) Returns the asset version for an asset. Parameters string $path A path Return Value string The version string string getUrl(string $path) Returns an

PackageFactory deprecated

class PackageFactory deprecated since 2.7, will be removed in 3.0. Use the Asset component instead. Creates packages based on whether the current request is secure. Methods __construct(ContainerInterface $container) PackageInterface getPackage(Request $request, string $httpId, string $sslId) Returns either the HTTP or SSL version of an asset package. Details __construct(ContainerInterface $container) Parameters ContainerInterface $co