2

I am trying to create a new composer library package. I created the composer.json file using the

composer.phar create-project xlix vendor/xlix/xlix 0.3

command.

In the filesystem the file composer.json exists under vendor/xlix/xlix and for testing purposes I copied it to vendor/xlix.

The composer.json file content is the following:

{
    "name": "xlix/xlix",
    "type": "library",
    "description": "XLIX package",
    "keywords": ["core"],
    "homepage": "http://myhomepage",
    "license": "GPL",
    "authors": [
        {
            "name": "Florian Kasper",
            "email": "florian.kasper@mymail"
        }
    ],
    "require": {
        "php": ">=5.2.4"
    },
    "autoload": {
        "psr-0" : {
            "Xlix\\Bundle" : "lib/"
        }
    },
    "extra": {
        "branch-alias": {
            "dev-master": "1.0"
        }
    }
}

Then I tried the following commands:

git:(master) ✗  php composer.phar require xlix/xlix
git:(master) ✗  php composer.phat require vendor/xlix
...

git:(master) ✗  php composer.phar install vendor/xlix
git:(master) ✗  php composer.phar install xlix/xlix
...

Every time the same output:

Please provide a version constraint for the xlix/xlix requirement: *
composer.json has been updated
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package xlix/xlix 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.

In my ROOTDIR/composer.json file the package is registered in the require section.

"jms/security-extra-bundle": "1.2.*",
"jms/di-extra-bundle": "1.1.*",
"kriswallsmith/assetic": "1.1.*@dev",
"xlix/xlix": ">=0.*"

Now I am on the edge of despair an don't know what to do anymore.

Question:

Are there any mistakes I've made or is there anything i missed?

4

1 回答 1

4

软件包存在于互联网上,而不是您的文件系统上。

默认情况下,Composer 会搜索一个xlix/xlixpackagist上调用但不存在的包。您可以使用repositories配置添加更多包存储库,更多信息请参阅文档

因此,为了要求您的包带有作曲家,您需要在xlix某处上传您的目录。


我没有看到您在lxix目录中尝试做什么?您在lxix包中,为什么要在同一个包中要求它?看起来您不了解这些命令的作用以及作曲家的工作原理。也许好好阅读他们自己的文档——或者其他一些关于 Composer 的教程(比如nettuts+上的那个)——会帮助你更好地理解 composer。

于 2012-12-11T19:23:01.140 回答