MrSo
MrSo

Reputation: 640

Add multiple library in composer.json

Actually I have tried this but it doesn't work. I'd like to preserve authors and descriptions. Of course I can do without. However I would like to know how to make this possible.

{
    "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": "[email protected]"
        }
    ],
    "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": "[email protected]",
            "role": "Developper"
        }
    ],
    "autoload": {
        "psr-0": {
            "SimpleAcl": "SimpleAcl/"
        }
    }
}

Upvotes: 2

Views: 3866

Answers (1)

Alexandre Danault
Alexandre Danault

Reputation: 8682

Composer encourages one library per package, so in your case you'd be better making two distinct packages for your two distinct libraries.

Also, see https://github.com/composer/composer/issues/1875

There is a workaround where you create a "master" package that "requires" your two sub-packages.

Upvotes: 2

Related Questions