Reputation: 671
I want to try with this OAuth2-Server Example ( https://github.com/alexbilbie/oauth2-example-auth-server
) but when I want to run it gives me error " Fatal error: Interface 'OAuth2\Storage\ClientInterface' not found in /var/www/oauth2-auth-server/model_client.php on line 2 "
I think I need to add autoloader to composer.json I did it but forever it gives me this error. But I also think in oauth.php I found this line:
// Initiate the auth server with the models
$server = new \OAuth2\AuthServer(new ClientModel, new SessionModel, new ScopeModel);
But there is no any AuthServer
in the OAuth folder? Is there anybody used this example. Thanks in advance!
Upvotes: 0
Views: 2081
Reputation: 6620
Autoloading is done automatically using Composer assuming you've downloaded the dependencies from modules stated in the require
key of your composer.json
file. Just include this at the top of your PHP script to access the Classes:
require_once __DIR__.'/to/vendor/autoload.php';
If these are manually downloaded packages you'll need to point the autoloader to them and run composer update
:
"autoload": {
"psr-0": {
"Util\\": "assets/"
},
"files": ["assets/Util/init.php"]
}
The above automatically:
assets/Util/init.php
to every file where the autoloader is run;assets/Util/
) into any file that runs the autoloaderYou may also need to manage namespace issues using the use Namespace\Class as Class;
syntax.
Upvotes: 2