diff --git a/com_oauthserver/administrator/services/provider.php b/com_oauthserver/administrator/services/provider.php index 308740b..d3aa6c5 100644 --- a/com_oauthserver/administrator/services/provider.php +++ b/com_oauthserver/administrator/services/provider.php @@ -14,8 +14,6 @@ use Webmasterskaya\Component\OauthServer\Administrator\Extension\Component; \defined('_JEXEC') or die; -require_once JPATH_LIBRARIES . '/lib_oauthserver/vendor/autoload.php'; - return new class implements ServiceProviderInterface { public function register(Container $container): void diff --git a/com_oauthserver/administrator/src/Extension/Component.php b/com_oauthserver/administrator/src/Extension/Component.php index d6cf14b..42b67b9 100644 --- a/com_oauthserver/administrator/src/Extension/Component.php +++ b/com_oauthserver/administrator/src/Extension/Component.php @@ -32,5 +32,20 @@ class Component extends MVCComponent implements */ public function boot(ContainerInterface $container): void { + self::requireDependency(); + } + + public static function requireDependency(): void + { + static $required; + + if (!isset($required)) { + /** @var \Composer\Autoload\ClassLoader $loader */ + $loader = require JPATH_LIBRARIES . '/lib_oauthserver/vendor/autoload.php'; + + $loader->unregister(); + + spl_autoload_register([new \Joomla\CMS\Autoload\ClassLoader($loader), 'loadClass'], true, true); + } } } \ No newline at end of file