Неустранимая ошибка: неперехваченная ошибка: класс 'ClientRepository' не найден - PullRequest
1 голос
/ 06 ноября 2019

Я использую этот код:

require_once __DIR__."/vendor/autoload.php";

use League\OAuth2\Server\AuthorizationServer;
use League\OAuth2\Server\Exception\OAuthServerException;
use League\OAuth2\Server\Grant\PasswordGrant;
use League\OAuth2\Server\Repositories\ClientRepositoryInterface;

$clientRepository = new ClientRepository();

Но я получаю ошибку:

Неустранимая ошибка: ошибка Uncaught: класс 'ClientRepository' не найден в / home / a / public_html/app/oauth2.php:23 Трассировка стека: # 0 {main} добавляется в /home/a/public_html/app/oauth2.php в строке 23

1 Ответ

0 голосов
/ 06 ноября 2019

Возможно, вы забыли пространство имен:

require_once __DIR__."/vendor/autoload.php";

use League\OAuth2\Server\AuthorizationServer;
use League\OAuth2\Server\Exception\OAuthServerException;
use League\OAuth2\Server\Grant\PasswordGrant;
use League\OAuth2\Server\Repositories\ClientRepositoryInterface;

use NamespaceClass\ClientRepository; <-- edit

$clientRepository = new ClientRepository();
...