Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.x] Allow fetching additional laravel extra sections from package composer.json files #31039

Merged
merged 3 commits into from Jan 6, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 15 additions & 6 deletions src/Illuminate/Foundation/PackageManifest.php
Expand Up @@ -58,16 +58,27 @@ public function __construct(Filesystem $files, $basePath, $manifestPath)
$this->vendorPath = $basePath.'/vendor';
}

/**
* Get all of the $name values for all packages.
*
* @param string $name
* @return array
*/
public function getRegisteredExtra($name)
{
return collect($this->getManifest())->flatMap(function ($configuration) use ($name) {
return (array) ($configuration[$name] ?? []);
})->filter()->all();
}

/**
* Get all of the service provider class names for all packages.
*
* @return array
*/
public function providers()
{
return collect($this->getManifest())->flatMap(function ($configuration) {
return (array) ($configuration['providers'] ?? []);
})->filter()->all();
return $this->getRegisteredExtra('providers');
}

/**
Expand All @@ -77,9 +88,7 @@ public function providers()
*/
public function aliases()
{
return collect($this->getManifest())->flatMap(function ($configuration) {
return (array) ($configuration['aliases'] ?? []);
})->filter()->all();
return $this->getRegisteredExtra('aliases');
}

/**
Expand Down