Download the PHP package nodejs-php-fallback/nodejs-php-fallback without Composer
On this page you can find all versions of the php package nodejs-php-fallback/nodejs-php-fallback. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nodejs-php-fallback/nodejs-php-fallback
More information about nodejs-php-fallback/nodejs-php-fallback
Files in nodejs-php-fallback/nodejs-php-fallback
Package nodejs-php-fallback
Short Description Allow you to call node.js module or scripts throught PHP and call a fallback function if node.js is not available
License MIT
Informations about the package nodejs-php-fallback
NodejsPhpFallback
Allow you to call node.js module or scripts throught PHP and call a fallback function if node.js is not available.
Usage
Edit composer.json to add nodejs-php-fallback to "require", your "npm" dependancies to "extra" and to both "post-install-cmd" and "post-update-cmd" in "scripts"
For example, to use node.js stylus and fallback to the php kylekatarnls/stylus port, use:
With this configuration, both node stylus and php kylekatarnls/stylus packages will be installed and updated when you update or install with composer if node is installed, else, only the php package will be.
So you can easily create a function that will try first to call the node package, then else the php one:
Here will contain CSS code rendered from your stylus file, no matter node is installed or not. So you can install node on your production environment to benefit of the last official version of a npm package but any one can test or develop your project with no need to install node.
Note: the PHP fallback can be a simple php function, not necessarily a call to a class or a composer package.
Settings
The extra.npm can be an object with npm required packages as key and versions for each of them as value (see https://docs.npmjs.com/misc/semver for version definition). You can also set it as an array of package names, it's the same as specify all packages dependancies with version. Else if you need only one package and don't care about the version, just pass it as a string:
Array configuration:
String configuration:
Ask the user to confirm package install
You can use the npm-confirm
setting to ask the user if he want to install one
or more npm package. This should be used to make the user aware npm packages
will be installed, and what for they are. This is also a way to not install
optional packages if they are used in a user specific case.
With the configuration above, when the user will execute compoers update
or
composer install
, he will be asked the following:
Each of stylus
and less
packages will be installed only if the user enter Y
on confirm
or if he ran the command with the mode --no-interaction
.
The clean-css
package will be installed with no confirm.
All versions of nodejs-php-fallback with dependencies
composer-plugin-api Version ^1.0 || ^2.0