initial import

This commit is contained in:
2025-07-30 09:47:03 +02:00
commit b0a186a324
292 changed files with 32323 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Api\Plugins;
use InvalidArgumentException;
class PluginLoader
{
protected static $plugins = [];
public static function registerPlugin(string $name, string $className)
{
if (!class_exists($className)) {
throw new InvalidArgumentException("Plugin class {$className} not found.");
}
if (!in_array(ApiPluginInterface::class, class_implements($className))) {
throw new InvalidArgumentException("Plugin class {$className} must implement ApiPluginInterface.");
}
static::$plugins[$name] = $className;
}
public static function getPlugin(string $name): ApiPluginInterface
{
if (!isset(static::$plugins[$name])) {
throw new InvalidArgumentException("Plugin {$name} not registered.");
}
return new static::$plugins[$name]();
}
}