Skip to content

Commit

Permalink
Add Error Message if vendor is not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
vafNellinger committed Jul 31, 2024
1 parent 044c4a7 commit d20921d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ final public static function registerPlugin(string $file, bool $debug = false):
*/
final public static function buildContainer(): void
{
if (!self::pluginVendorExists())
{
die('Please run "composer install" to ensure all dependencies are installed.');
}

// Set debug to true to always renew the container
$obj = new static('__BUILD__', getcwd(), '__BUILD__', true);
$obj->kernel->forceContainerCacheUpdate();
Expand All @@ -52,4 +57,10 @@ private function registerPluginApi(): void
return $this;
}, 10, 0);
}

private static function pluginVendorExists(): bool
{
$relVendorLocation = __DIR__ . '/../../../../vendor';
return file_exists($relVendorLocation) && is_dir($relVendorLocation);
}
}

0 comments on commit d20921d

Please sign in to comment.