slejnej / asset-installer
Install npm from composer script
Installs: 1 368
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/slejnej/asset-installer
Requires
- php: >=8.1
- ext-json: *
- symfony/filesystem: *
- symfony/process: *
- symfony/yaml: *
This package is auto-updated.
Last update: 2025-11-29 13:30:52 UTC
README
Install all your npm assets via composer
Installation
- install via composer
composer req slejnej/asset-installer - add asset installation script to your composer
"scripts": { "post-install-cmd": [ "slejnej\\AssetInstaller\\InstallerHandler::installAssets" ] } - add npm packages direct to your composer
"extra": { "npm": { "leaflet": "^1.7.1" } } - run
composer install
In case
If this package is included in one of your vendor dependencies, then the scripts are not run for security reasons. As a work around you can use in primary composer.json something like this:
find ./vendors -maxdepth 2 -type f -name composer.json -exec bash -c "cat {} | grep ::installAssets && composer install --working-dir $(dirname {})" \;
It will find all the files that contain php command installAsset and then execute composer install in containing folder.
Update ./vendors folder where it should look in and adjust maxdepth and update you composer` executable.