php - Custom composer autoload directory, loading multiple packages -
im developing group of packag within laravel 5 app.
all packages have following structure.
folder structure:
vendor/package/src
composer.json
"autoload": { "psr-4": { "vendor\\package\\": "src/" } },
i able have separate folder outside of vendors/
folder contains packages, under development. basis application. note: these packages not downloaded through composer, auto-loaded composer.
e.g.
\laravel-app \app \bootstrap \config \database \public ... \src
the \src
directory containing packages mentioned above.
it's not relevant there composer.json inside each package, because not managed composer (, yet). autoload definition used autoload dump composer, if package installed/updated. here there not handled composer, sitting around in folder.
there multiple ways of solving autoloading problem. could:
- use php autoload functions register own autoloader (during bootstrap)
- use laravel's autoloader add path these packages (during app bootstrap, somewhere after laravel autoloader init)
- use composer's autoloader add paths these packages (during app bootstrap, after composer init)
- but easiest way define mapping in autoload section of
composer.json
file of main application. included in dumped autoloader, after install or update of composer managed dependencies.
Comments
Post a Comment