mercredi 16 novembre 2016

How To Autoload Namespace By Own 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?


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire