After successfully setting up a basic app following the steps outlined in this installation guide for Yii, I encountered a new challenge. The requirement now is to utilize q.js, which is available as an npm package. However, I am unsure of how to incorporate it using composer. Although alternatives like using a CDN or manual download are possible, my preference is to utilize composer. How can I achieve this?
In my composer.json file, I included the following:
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": ">=2.0.4",
"yiisoft/yii2-bootstrap": "*",
"yiisoft/yii2-swiftmailer": "*",
"npm-asset/q": "~1.4" <------
},
Upon running composer.phar update
, I encountered the error:
Your requirements could not be resolved to an installable set of packages. Problem 1 - The requested package npm-asset/q could not be found in any version, there may be a typo in the package name.
This raises the question of whether my approach is incorrect.
I am also seeking guidance on how to add JavaScript libraries to the project. While I understand that adding it to an Asset is necessary at a later stage, my current hurdle is obtaining the JS file initially.
* Is 'hosted' the appropriate term to use in this context?