在composer.json中添加多个库

时间:2013-06-10 14:19:09

标签: composer-php

其实我已经尝试了这个,但它不起作用。我想保留作者和描述。我当然可以不用。但是,我想知道如何使这成为可能。

{
    "name": "masterexploder/PHPThumb",
    "type": "library",
    "description": "A library for manipulating images in PHP.",
    "homepage": "https://github.com/masterexploder/PHPThumb",
    "keywords": ["image", "resize", "rotate"],
    "require": {
            "php": ">=5.3.0",
            "symfony/filesystem": "2.2.*"
    },
    "authors": [
        {
            "name": "Ian Selby",
            "email": "ian@gxdlabs.com"
        }
    ],
    "autoload": {
        "psr-0": {
            "PHPThumb": "src",
            "PHPThumb\\Tests": "tests"
        }
    }

},
{
    "name": "alexshelkov/simpleacl",
    "type": "library",
    "description": "Simple Access Control List (ACL) for PHP.",
    "keywords": ["ACL", "authorization", "permission"],
    "homepage": "https://github.com/alexshelkov/SimpleAcl",
    "require": {
        "php": ">=5.3.0"
    },
    "authors": [
        {
            "name": "Alex Shelkovskiy",
            "email": "alexshelkov@gmail.com",
            "role": "Developper"
        }
    ],
    "autoload": {
        "psr-0": {
            "SimpleAcl": "SimpleAcl/"
        }
    }
}

1 个答案:

答案 0 :(得分:2)

Composer鼓励每个包一个库,因此在您的情况下,您最好为两个不同的库创建两个不同的包。

另请参阅https://github.com/composer/composer/issues/1875

有一种解决方法,您可以创建一个“主”包,“需要”您的两个子包。