php composer package: problem with dev-master version - php

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

Related

Composer: class not found League\Uri\UriString

My composer.json entry under "require" has this line:
"league/uri-parser": "^1.4",
Links to the package:
packagist.org
github.com
I get an exception that the following class is missing: League\Uri\UriString
I also found that v1.4.0 is not the latest version.
Things I've tried to update to the latest version
composer remove league/uri-parser followed by composer require league/uri-parser. It doesn't change anything
composer update. no change
vendor/bin/composer dump-autoload -o. No change.
composer clearcache and composer upgrade while the library was set to * and ^1.4 but terminal kept reporting "nothing to install or update"
Anyone know how to fix this?
The class is named League\Uri\Parser\UriString in the current release (v1.4.1) of league/uri-parser.
The \Parser\ part was removed only on the master branch but the latest release (v1.4.1) still uses the old namespace! ( See the commit )
Use the correct class (League\Uri\Parser\UriString) and your issue will be resolved.

Composer can't install

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.

How to install Composer using Composer?

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.

How to force a package to be installed?

I'm trying to install the following package through composer:
https://packagist.org/packages/cartalyst/sentry#dev-feature/laravel-5
When I do:
composer require cartalyst/sentry dev-feature/laravel-5
I always receive this error:
[InvalidArgumentException]
Could not find package dev-feature/laravel-5 at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability
If I change minimum-stability to dev it will still complain.
However, if I install dev-master and manually merge the files from dev-feature/laravel-5 into dev-master, it works fine.
Hence why I'm asking how to force this package to be installed via composer.
To force the installation of this package, I added the following to the require element of composer.json:
"cartalyst/sentry":"dev-feature/laravel-5 as 2.1.4"
Below is the link from where I found this suggestion:
http://vvv.tobiassjosten.net/php/have-composer-use-development-branches/
It will not work from the command line, must be through composer.json. That I don't know why.
Update:
I believe I was wrong in my last statement above, actually something like the following will work from the command line:
composer require "codeception/codeception":"2.1.0-rc1 as 2.0.9"
Try to use this
composer require "cartalyst/sentry": "2.0.*#dev"
I believe sentry is not fully compatible with Laravel 5 yet

Composer + twitter bootstrap 2

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.

Categories