class Packages
Helps manage asset URLs.
__construct(PackageInterface $defaultPackage = null, array $packages = array()) | ||
setDefaultPackage(PackageInterface $defaultPackage) | ||
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(string $path, string $packageName = null) Returns the public path. |
PackageInterface | $defaultPackage | The default package |
array | $packages | Additional packages indexed by name |
PackageInterface | $defaultPackage |
Adds a package.
string | $name | The package name |
PackageInterface | $package | The package |
Returns an asset package.
string | $name | The name of the package or null for the default package |
PackageInterface | An asset package |
InvalidArgumentException | If there is no package by that name |
LogicException | If no default package is defined |
Gets the version to add to public URL.
string | $path | A public path |
string | $packageName | A package name |
string | The current version |
Returns the public path.
Absolute paths (i.e. http://...) are returned unmodified.
string | $path | A public path |
string | $packageName | The name of the asset package to use |
string | A public path which takes into account the base path and URL path |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/Asset/Packages.html