php - Custom autoloader for project vs Composer PSR-4 -


i'm working on small framework has following directory structure:

/ -- app -- vendor    -- framework-vendor       -- framework-package          -- src 

currently have in framework's composer.json 2 psr-4 instances:

"autoload": {     "psr-4" : {         "frameworkname\\" : "src/",         "": "../../../app"     } } 

the goal of actual project located @ app can use classes in framework using \frameworkname\foo\bar\class own classes using \foo\bar\class. limitation relative depth between vendor directory , app directory.

what's best way this? include second autoloader or enforce directory structure , let composer take care of generating autoloader?

the solution not force relative path depth use autoloader returned composer this:

$loader = require 'vendor/autoload.php'; $loader->add('', __dir__ . '/app/'); 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -