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.
Related
I want to use: https://github.com/mikealmond/MusicBrainz
Copied the lib in myapp->vendor Folder. Installed Guzzle with composer and updated composer.
use GuzzleHttp\Client;
use MusicBrainz\Filters\ArtistFilter;
use MusicBrainz\Filters\RecordingFilter;
use MusicBrainz\HttpAdapters\GuzzleHttpAdapter;
use MusicBrainz\MusicBrainz;
require __DIR__ . '/vendor/autoload.php';
The autoload does not work. I tried many things and don't know, what to write in the composer.json.
Error: Class 'MusicBrainz\MusicBrainz' not found
When i call:
$brainz = new MusicBrainz(new GuzzleHttpAdapter(new Client()));
I tried in composer.json
"require-dev": {
"vendor/MusicBrainz": "dev-master"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/mikealmond/MusicBrainz.git"
}
],
Then composer update...
And i get:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package src/musicbrainz 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://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
Go to the linked repository page on Github. In the root folder, click on the file named composer.json. Search for a line with "name". The text right to it is the name of this package that you have to use in Composer.
Alternatively, go to https://packagist.org and type something close to the actual name into the search field, like musicb. Something will be found: https://packagist.org/search/?q=musicb
In any case, you will find the package name: mikealmond/musicbrainz.
Now go to the command line and type: composer require mikealmond/musicbrainz. Composer will do the rest, including the download of Guzzle because this is declared as a dependency.
After that step, the demo code will work - or at least will not fail because of missing classes.
Ok, I'm using Yii2 and I am trying to add a new requirement/library to the project. Said library can be found here: https://github.com/cyphix333/SBBCodeParser
It is a forked project with an added composer.json.
I tried adding it as a requirement in the projects main composer file, ie:
"require": {
//..........
"samclarke/sbb-code-parser": "*"
},
Then I ran:
composer update
It just complained that it couldn't find the package or any version of it.
Then I removed that line and tried:
require samclarke/sbb-code-parser
I have the files already in my Yii vendor folder located at: #app/vendor/samclarke/sbb-code-parser
I'm pretty new to composer and am not sure what I'm doing wrong or how composer actually is supposed to know where to get the files from based on the package name.
The package samclarke/sbb-code-parser can be found at Packagist.
https://packagist.org/packages/samclarke/sbb-code-parser
By default Composer tries to resolve a stableset of packages.
But this packages doesn't provide a stable version (version tag), yet - only the dev-master version exists. Composer can not resolve it.
In order to require it, you need to lower your minimum-stability for this package to development.
You might do this for one package explicitly:
"require": {
"samclarke/sbb-code-parser": "dev-master#dev"
},
Or for all packages by setting:
"minimum-stability": "dev"
The package cyphix333/SBBCodeParser is not on Packagist.
It's a private fork. If you want exactly this code. You might add a repositories section to your composer.json and add repo with url and type with vcs there. Then Composer can load the package from the VCS repository over at Github. This is described here: https://getcomposer.org/doc/05-repositories.md#loading-a-package-from-a-vcs-repository
That would work like this:
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/cyphix333/SBBCodeParser"
}
],
"require": {
"samclarke/sbb-code-parser": "dev-master"
}
}
But unfortunately, the fork is also not well maintained and doesn't contain a valid composer.json file.
[Composer\Repository\InvalidRepositoryException]
No valid composer.json was found in any branch or tag of https://github.com/cyphix333/SBBCodeParser, could not load a package from it.
This needs to be fixed first....
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
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.
I have this in my composer.json file:
"require": {
"phpmd/phpmd:": "1.4.0"
}
When I do:
php composer.phar update
I get:
Problem 1
- The requested package phpmd/phpmd: 1.4.0 could not be found.
In the documentation they say it can be isntalled through composer with the line I used - "phpmd/phpmd:": "1.4.0".
But it's not working.
http://phpmd.org/download/index.html
Why?
The phpmd/phpmd package is at packagist (https://packagist.org/packages/phpmd/phpmd), the default repository for composer to search for packages. Not being able to locate phpmd sounds like you either have an offline system, a problem with your network or packagist.org had a timeout.
/edit:
I see you have a typo. Don't write phpmd/phpmd: but phpmd/phpmd (without the trailing colon).