0

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 ...
Limon Monte
  • 52,539
  • 45
  • 182
  • 213
castarco
  • 1,368
  • 2
  • 17
  • 33

3 Answers3

1

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

dlegall
  • 412
  • 2
  • 5
  • Thank you for the idea. I've discovered a mistake in the version I've been using. Your solution is interesting but it doesn't work to me, I'm sure that's because a mistyping too.. – castarco Jul 08 '15 at 17:06
  • Just corrected my answer. It would works now :). Nice to see you resolve your problem. Have a nice day! :) – dlegall Jul 08 '15 at 17:14
1

Ok, I've made a stupid mistake. I have to use "dev-master", not "dev" nor "master".

Sorry for this dumb question.

castarco
  • 1,368
  • 2
  • 17
  • 33
-3

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.

Petko Kostov
  • 367
  • 1
  • 9
  • Of course I already have composer, so it should be possible. But, without having to enter into full details, having access to the composer command doesn't mean that you have control over the installed composer binary (what if I need to fix the composer version?) – castarco Jul 08 '15 at 16:48
  • If one is writing a PHP application that needs access to the composer libraries, then using composer to install composer into the application's vendor directory is desirable. See the accepted answer of http://stackoverflow.com/questions/29078380/how-do-i-run-a-symfony-console-command-after-composer-install for an example. – David Baucum Dec 01 '15 at 22:01
  • "maybe this seems weird to you... but I'm trying to locally install composer using a global composer binary." Please read the question before you answer. – mopsyd Apr 01 '17 at 21:56