All options can be added in the composer.json
file of the project in the config.foxy.*
section.
Example:
{
"name": "root/package",
"config": {
"foxy": {
"enabled": false
}
}
}
You can define the options in the composer.json
file of each project, but you can also set an option
for all projects.
To do this, you simply need to add your options in the Composer global configuration, in the file of your choice:
<COMPOSER_HOME>/composer.json
file<COMPOSER_HOME>/config.json
file
Note: The
composer global config
command cannot be used, bacause Composer does not accept custom options. But you can use the commandcomposer global config -e
to edit the globalcomposer.json
file with your text editor.
You can define each option (config.foxy.*
) directly in the PHP environment variables. For
this, all variables will start with FOXY__
and uppercased, and each -
will replaced by _
.
The accepted value types are:
- string
- boolean
- integer
- JSON array or object
Example:
{
"config": {
"foxy": {
"enabled": false
}
}
}
Can be overridden by FOXY__ENABLED="false"
environment variable.
Example:
{
"config": {
"foxy": {
"enable-packages": {
"foo/*": true
}
}
}
}
Can be overridden by FOXY__ENABLE_PACKAGES="{"foo/*": true}"
environment variable.
The config values are retrieved in priority in:
- the environment variables starting with
FOXY__
- the project
composer.json
file - the global
<COMPOSER_HOME>/config.json
file - the global
<COMPOSER_HOME>/composer.json
file
All keys starting with the prefix manager-
can accept a unique value, but it will also can accept
a map containing the value for each manager defined by her name.
Example:
{
"config": {
"foxy": {
"manager-version": {
"npm": ">=5.0",
"yarn": ">=1.0.0"
}
}
}
}
Note:
This format is available only for the configuration file, and so, not available for the environment variables.
You can enable or disable the plugin with the option config.foxy.enabled
[boolean
, default: true
].
Example:
{
"config": {
"foxy": {
"enabled": false
}
}
}
You can choose the asset manager with the option config.foxy.manager
[string
, default: npm
].
Available values:
npm
yarn
Example:
{
"config": {
"foxy": {
"manager": "yarn"
}
}
}
You can validate the version of the asset manager with the option
config.foxy.manager-version
[string
, default: null
].
Example:
{
"config": {
"foxy": {
"manager-version": "^5.3.0"
}
}
}
You can define the custom path of the binary of the asset manager with the option
config.foxy.manager-bin
[string
, default: null
].
Example:
{
"config": {
"foxy": {
"manager-bin": "/custom/path/of/asset/manager/binary"
}
}
}
You can add custom options for the asset manager binary for the install and update commands with the
option config.foxy.manager-options
[string
, default: null
].
Example:
{
"config": {
"foxy": {
"manager": "yarn",
"manager-options": "--production=true --modules-folder=./assets"
}
}
}
Note:
It is rather recommended that you use the configuration files
.npmrc
for NPM, and.yarnrc
for Yarn
You can add custom options for the asset manager binary for the install command with the
option config.foxy.manager-install-options
[string
, default: null
].
Example:
{
"config": {
"foxy": {
"manager": "npm",
"manager-install-options": "--dry-run"
}
}
}
Note:
For this example, the option allow you to keep only the manipulation of the asset package file, and validate the dependencies without the installation of the dependencies
You can add custom options for the asset manager binary for the update command with the
option config.foxy.manager-update-options
[string
, default: null
].
Example:
{
"config": {
"foxy": {
"manager": "yarn",
"manager-update-options": "--flat"
}
}
}
You can define the execution timeout of the asset manager with the
option config.foxy.manager-timeout
[int
, default: null
].
Example:
{
"config": {
"foxy": {
"manager-timeout": 420
}
}
}
You can enable or disable the fallback of the asset package file with the option
config.foxy.fallback-asset
[boolean
, default: true
].
Example:
{
"config": {
"foxy": {
"fallback-asset": false
}
}
}
You can enable or disable the fallback of the Composer lock file and its dependencies with the option
config.foxy.fallback-composer
[boolean
, default: true
].
Example:
{
"config": {
"foxy": {
"fallback-composer": false
}
}
}
You can enable or disable the running of the asset manager with the option
config.foxy.run-asset-manager
[boolean
, default: true
].
Example:
{
"config": {
"foxy": {
"run-asset-manager": false
}
}
}
Note:
This option allow you to keep only the manipulation of the asset package file, without the execution of the asset manager
You can define the custom path of the mock package of PHP library with the option
config.foxy.composer-asset-dir
[string
, default: null
].
Example:
{
"config": {
"foxy": {
"composer-asset-dir": "./my/mock/asset/path/of/project"
}
}
}
By default, Foxy looks in the composer.json
file of the PHP dependencies, if the mock package needs
to be added into NPM or Yarn. However, some public PHP package already uses the package.json
file
to handle their asset dependencies, but Foxy is not enabled for this package. In this case, you can
manually enable the PHP packages to be scanned in your project.
Patterns can be written in Glob style or with regular expressions. In this case, the pattern must
start and end with slash (/
).
You can define the patterns to enable or disable the packages with the option
config.foxy.enable-packages
[array
, default: array()
].
Example:
{
"config": {
"foxy": {
"enable-packages": {
"/^bar\/*/": true,
"foo/*": true,
"baz/test-*": false
}
}
}
}
If you do not deactivate any packages, you can use a simple array.
Example:
{
"config": {
"foxy": {
"enable-packages": [
"/^bar\/*/",
"foo/*"
]
}
}
}