简体   繁体   中英

Delegating to Local composer.json

With my clean Laravel 5.3 installation, I can run composer install to install the dependent packages.

Now, I've an internal package with its own composer.json, like below:

{
    "name": "bar/foo",
    "description": "A package for handling foo",
    "licence": "MIT",
    "authors": [
    {
        "name": "A. Foo",
        "email": "a@foo.bar"
    }],
    "minimum-stability": "dev",
    "require": {},
    "autoload": {
        "psr-4": {
            "Foo\\Bar\\": "packages/foo/Bar/src"
        }
    }
}

So I prefer to autoload from the package itself, instead of autoloading from the main composer.json.

My questions:

  1. Running composer dumpa from packages/foo/Bar doesn't take effect for autoloading. After Generating autoload files , Laravel doesn't know namespace Foo\\Bar
  2. Is there a way to run composer dumpa for all recursive composer.jsons?

You need to add the following section to your global composer.json

"repositories": [
    {
        "type": "path",
        "url": "packages/*/*"
    }
]

You also need to add the packages to the require object in composer.json

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM