How I can add this repo https://github.com/twbs/bootstrap-sass/tree/2.1-stable to my composer.json?
I tryed this:
"minimum-stability": "dev",
"require-dev": {
"twbs/bootstrap-sass": "dev-2.1-stable"
}
but got error:
The requested package twbs/bootstrap-sass could not be found in any version, there may be a typo in the package name
dev-2.1-stable isnt in the package:
https://packagist.org/packages/twbs/bootstrap-sass
its a branch in their git repo, but they havent submitted those versions to packagist (or the tags they have given on the branches arent valid for packagist to pick them up on its own: https://packagist.org/about)
I am assuming you know they have a version 3 available. Also, do you not have Ruby gems installed? To install using their instructions add the package to your Gemfile, not to composer.
If you do want to install via composer, it has to be a composer package, which from https://packagist.org/packages/twbs/bootstrap-sass looks like only version 3 and up are available.
Try using:
"require-dev": {
"twbs/bootstrap-sass": "3.2.*"
}
Notice the 3 above, I tried 2.1.* and it couldn't be found. 3.2.* worked fine.
Also, incase you're wondering the * just means 'latest'. If you want 2.1 you might have to do it via Ruby Gems.
Related
I have this problem with composer. I created one package which is connected to github. I would like to set composer to use: dev-master version of my github code, not tag. But this is what i get during installing package:
[InvalidArgumentException]
Could not find a version of package zerig/url-parser matching your minimum-stability (stable). Require it with an e
xplicit version constraint allowing its desired stability.
When i create tag on github. When i update package on composer and when i delete all versions exept one tag version, then it works. But i would like to use dev-master version. Because every change force me to do a lot of operations.
This is what i tried and think, that it will help. But Not. composer.json:
"require": {
"php" : ">=5.6.0",
"zerig/url-parser": "dev-master"
},
Thanks a lot for your help
I am writing a php library and i published it on packagist but am unable to download it using composer
composer require merajsiddiqui/ibm-watson
But it throws error
[InvalidArgumentException]
Could not find package merajsiddiqui/ibm-watson at any version for your min
imum-stability (stable). Check the package spelling or your minimum-stabili
ty
Here is my repository: https://github.com/merajsiddiqui/ibm-watson
I would be thankful if you can guide me to successfully publishing so any one can download this library.
This is because your package is still in "dev" mode.
Add a tag to your repository, publish the tagged (versioned) repo.
Or add this to your composer.json:
"minimum-stability": "dev"
for example:
# composer.json
{
"name": "ProjectUsingMyIBMWatsonPackage",
"minimum-stability": "dev"
}
then run:
$ composer require merajsiddiqui/ibm-watson
Using version dev-master for merajsiddiqui/ibm-watson
(...)
- Installing merajsiddiqui/ibm-watson (dev-master f7b808d) Cloning f7b808dd97 from cache
minimum-stability: stable means that development versions of the library cannot be installed - that's the default minimum-stability setting. And for good reasons - a "dev" version changes constantly, and is thus unreliable.
You need to release an actual (non-RC, non-alpha, non-beta) version of your library for it to be considered "stable".
With Git, that means using git tag.
Go to:
https://packagist.org/
and create a package from your repo. Then it's available. Otherwise you have to add your repo in your composer configuration manually.
https://getcomposer.org/doc/05-repositories.md
The other problem is that your package is not marked es "stable" then your can't add them when your minimum stability is stable. So go to your composer.json and set them to stable.
How to mark code as stable using Composer?
Add "minimum-stability": "dev" in your composer json file or release version of your library.
EDIT: solved, I have to use "dev-master" instead of "master" or "dev".
maybe this seems weird to you... but I'm trying to locally install composer using a global composer binary.
I'm trying to write something like:
composer require composer/composer
But this doesn't work, it tells me that needs the version. Then I've tried the following variations:
composer require composer/composer=*
composer require composer/composer=master
composer require composer/composer=dev
And... nothing, I obtain the following error message:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package composer/composer could not be found in any version, there may be a typo in the package name.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
Installation failed, reverting ./composer.json to its original content.
Anyone has any idea if it's possible to do it in a "clean" way? (Allowing the following points):
specifying a very concrete version
registering it in the composer.json and composer.lock files
placing the composer binary with other php binaries like behat ...
Ok, I've made a stupid mistake. I have to use "dev-master", not "dev" nor "master".
Sorry for this dumb question.
Don't understand why do you want this, but I think #EDIT : Saw why you need this. Ok.
"repositories": [
{
"type": "vcs",
"url": "https://github.com/composer/composer.git"
}
],
"require": {
"composer/composer": "dev-master#775f6cd5c633facf2e7b99611fdcaa900b58ddb7"
}
would work.
You can view here the commit hash corresponding to different releases : https://github.com/composer/composer/releases
Well, it seems to me that you are trying to install composer using composer itself. That of course is not possible.
To install composer you need to first download it from here.
Once you have done that you will be able to install packages using the 'require' command.
I want to use the Mailgun service in Laravel 5. This requires Guzzle 5 to be installed. I've added the following to composer.json, and installed it:
"guzzlehttp/guzzle": "~5.0"
However, my app is giving me this error:
FatalErrorException in MailgunTransport.php line 121:
Class 'GuzzleHttp\Client' not found
I've ran composer dump-autoload. What am I missing? Thanks.
I solve this by using:
"laravel/framework": "5.0.16",
"guzzlehttp/guzzle": "5.2",
composer update
and that is all.
composer install installs the packages (including exact versions) listed in composer.lock. When adding a new package or changing the version requirements, you need composer update (or you can use composer require) as the new package isn't in the lock file yet.
Running composer install when the composer.json has been updated since the last update/require should generate a warning saying Warning: The lock file is not up to date with the latest changes in composer.json, you may be getting outdated dependencies, run update to update them.
I am trying to get Composer do download the latest commit for the Behat/MinkSelenium2Driver package. That particular repo only has a master branch. I have tried every method I can think of, including deleting the files and letting it pull them back in, to get it to work but it doesn't.
How would I get it to pull in latest committed files or at least those from the commit I list below?
Specifically I want to get this commit:
https://github.com/Behat/MinkSelenium2Driver/commit/2e73d8134ec8526b6e742f05c146fec2d5e1b8d6
Thanks,
Patrick
There is only one way to grab the head of the repository:
"require": { "behat/mink-selenium2-driver" : "dev-master" }
"minimum-stability": "dev"
Oh well, at least two ways:
"require": { "behat/mink-selenium2-driver" : "dev-master as 1.1.x-dev" }
"minimum-stability": "dev"
Probably at least three ways:
"require": { "behat/mink-selenium2-driver" : "dev-master#2e73d8134ec8526b6e742f05c146fec2d5e1b8d6" }
"minimum-stability": "dev"
Because that repository actually aliased the master branch as 1.1.x-dev, this would also work without the minimum-stability affecting all other packages:
"require": { "behat/mink-selenium2-driver" : "1.1.*#dev" }
Simply specify the master branch:
composer require --dev behat/mink-selenium2-driver:dev-master
PS: the --dev is just to specify it's a test/development requirement, that's probably what you want.
In our case, none of the previous answers were working. It turned out to be something simple:
Composer only uses the repositories attribute of the ROOT composer.json
https://getcomposer.org/doc/04-schema.md#repositories
In our case, we were trying to get the latest commit from dev-master of one of our transitive dependencies. There was some problem with the hooks between github and packagist preventing it from working like normal and it took us a couple hours to realize that we were editing the wrong composer.json (the one from our library that carries the dependency) instead of the top-level composer.json that we were installing.
For my case, all the 03 suggested solutions above from #Sven didn't work. This was my solution in case someone still struggling on a similar context.
remove existing usage if you have it composer remove the_vendor/the_package_name
If you have access to the package repo, create a 1st tag for it (eg: 0.1.0)
git tag --annotate 0.1.0 --message "Initial version 0.1.0"
git push origin 0.1.0
Note:
Each time you update your package repo, pls attribute a new tag (eg: 0.1.1) & make composer update the_vendor/the_package_name on main app to update the composer.lock
If you don't have access to the package repo, pick existing tag version (not dev-master)
require it from main app
composer require the_vendor/the_package_name:^0.1
from master