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.

    链接地址: http://www.djcxy.com/p/41082.html

    上一篇: 用数组发送HTTP Post

    下一篇: 如何使用Composer安装Composer?