Add composer support for plugins
This commit is contained in:
parent
0a307e9221
commit
86a5631431
@ -38,6 +38,11 @@ class PluginServiceProvider extends ServiceProvider
|
||||
$this->registerPluginCallbackListener();
|
||||
$this->registerClassAutoloader($src_paths);
|
||||
|
||||
// Register plugin's own composer autoloader
|
||||
foreach ($plugins->getEnabledComposerAutoloaders() as $autoloader) {
|
||||
require $autoloader;
|
||||
}
|
||||
|
||||
$bootstrappers = $plugins->getEnabledBootstrappers();
|
||||
|
||||
foreach ($bootstrappers as $file) {
|
||||
|
@ -219,6 +219,24 @@ class PluginManager
|
||||
return $bootstrappers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads composer autoloader for the enabled plugins if exists.
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getEnabledComposerAutoloaders()
|
||||
{
|
||||
$autoloaders = new Collection;
|
||||
|
||||
foreach ($this->getEnabledPlugins() as $plugin) {
|
||||
if ($this->filesystem->exists($file = $plugin->getPath().'/vendor/autoload.php')) {
|
||||
$autoloaders->push($file);
|
||||
}
|
||||
}
|
||||
|
||||
return $autoloaders;
|
||||
}
|
||||
|
||||
/**
|
||||
* The id's of the enabled plugins.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user