mirror of
https://github.com/laravel/valet.git
synced 2026-02-06 16:50:09 +01:00
Add the ability for drivers to check Composer dependencies (#1345)
This commit is contained in:
@@ -196,4 +196,20 @@ public function loadServerEnvironmentVariables(string $sitePath, string $siteNam
|
||||
putenv($key.'='.$value);
|
||||
}
|
||||
}
|
||||
|
||||
public function composerRequires(string $sitePath, string $namespacedPackage): bool
|
||||
{
|
||||
if (! file_exists($sitePath.'/composer.json')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$composer_json_source = file_get_contents($sitePath.'/composer.json');
|
||||
$composer_json = json_decode($composer_json_source, true);
|
||||
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return isset($composer_json['require'][$namespacedPackage]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user