To use Foxy, whether for a PHP library or a PHP project, you must add the Foxy dependency in
the require section of the Composer file.
composer.json:
{
"require": {
"php-forge/foxy": "^0.1"
}
}And create the package.json file to add your asset dependencies.
package.json:
{
"dependencies": {
"@foo/bar": "latest"
}
}Composer will install Foxy automatically before installing the PHP dependencies, and Foxy will immediately deal with the asset dependencies.
In the case if you use Foxy in a PHP library, you can render Foxy optional by adding its dependency in
the require-dev section of the Composer file.
composer.json:
{
"require-dev": {
"php-forge/foxy": "^0.1"
}
}Note:
If no PHP dependency requires Foxy inevitably (always in
require-devsection), you must add Foxy in the required dependencies to thecomposer.jsonfile of your project.
However, if you want enable the Foxy for your library, but without required dependencies or dev dependencies,
you can use the extra option extra.foxy in your composer.json file:
composer.json:
{
"extra": {
"foxy": true
}
}Note:
Like for the activation with the Foxy dependencies, you must add Foxy in the required dependencies to the
composer.jsonfile of your project.
package.jsonwrites always use 4-space indentation.root-package-json-dircontrols realpackage.jsonread, write, and merge operations and the working directory used to run the asset manager.root-package-json-dirsupports relative and absolute paths, and filesystem roots such as/orC:\are preserved.- The working directory is restored after running the asset manager; no working directory leaks occur.
- Nested empty arrays in
package.jsonare preserved during rewrites. - I/O failures during read or write operations throw a
RuntimeException.