I\'m trying to install jQuery components via Composer in CakePHP app, the composer.json:
{
\"name\": \"affiliate\",
\"require\": {
\"cakephp/
The components/jquery
package uses component-installer, which can read from your composer.json
a specified component-dir
setting which is where you want to put the downloaded components - e.g. in your web/assets
folder:
{
"require": {
"components/jquery": "*"
},
"config": {
"component-dir": "web/assets"
}
}
To read more about this check out the docs here.
You can then add those downloaded component files in web/assets to your .gitignore so that you're not adding files which are loaded in by the package manager.
If you're not a fan of this approach, then one other option is that you can add your own package repository to your composer.json
like this:
{
"repositories": [
{
"type": "package",
"package": {
"name": "jquery/jquery",
"version": "2.1.1",
"dist": {
"url": "http://code.jquery.com/jquery-2.1.1.js",
"type": "file"
}
}
}
],
"require": {
"jquery/jquery": "2.1.1"
}
}
With this approach, composer will download the JS file to vendor/jquery/jquery/jquery-2.1.1.js
- you can then add a symlink to this from your www root directory.