n98-magerun icon indicating copy to clipboard operation
n98-magerun copied to clipboard

composer vendor autoloads

Open magicaner opened this issue 10 years ago • 2 comments

in case if there is vendors extensions under magento root it will be good to have them inlcuded to autolad process. can you add automatic include for {magento_root}/vendor/autoload.php please

magicaner avatar Jun 03 '14 10:06 magicaner

Thanks. I must check this, because you can run n98-magerun from source installed by composer. In this case the vendor/autoload.php in Magento root is already used. The other normal use case that n98-magerun runs in phar mode. In this case we have our own vendor folder inside the phar package with an own composer autoaloader. I don't know if we can combine multiple composer autoloaders.

cmuench avatar Jun 04 '14 10:06 cmuench

multiple composer autoloaders are not a problem as the generated autoloader class gets a unique prefix which has avoiding such conflicts as side effect.

I would also like to have a config in the magerun config file which can point to other autoload files (I tend to have the vendor directory one directory level above)

Flyingmana avatar Jun 04 '14 23:06 Flyingmana

In the meantime we have support for this use-case. There is a \N98\Magento\Application\AutoloaderDecorator in the Magerun core which tries to load a class from Magerun vendor folder. If that class is not loadable it tries as fallback to load with the Magento autoloader.

I close this issue. If this is still not helping in your case, please re-open the issue.

cmuench avatar Dec 16 '23 14:12 cmuench