PHP implementation of https://openid.net/specs/openid-connect-discovery-1_0.html
Via Composer
$ composer require digitalcz/oidc-discovery
If php-http/discovery
package is present, DiscoveryFactory will use it to find PSR18 client and PSR17 factory.
use DigitalCz\OpenIDConnect\Discovery\DiscovererFactory;
$discoverer = DiscovererFactory::create()
$providerMetadata = $discoverer->discover('https://accounts.google.com/.well-known/openid-configuration');
$issuer = $providerMetadata->issuer(); // https://accounts.google.com
$tokenEndpoint = $providerMetadata->tokenEndpoint(); // https://oauth2.googleapis.com/token
otherwise, you can provide these manually
use DigitalCz\OpenIDConnect\Discovery\DiscovererFactory;
use Http\Client\Curl\Client;
use Nyholm\Psr7\Factory\Psr17Factory;
$client = new Client();
$requestFactory = new Psr17Factory();
$discoverer = DiscovererFactory::create($client, $requestFactory);
use DigitalCz\OpenIDConnect\Discovery\DiscovererFactory;
use Symfony\Component\Cache\Adapter\FilesystemAdapter
use Symfony\Component\Cache\Psr16Cache;
$cache = new Psr16Cache(new FilesystemAdapter())
$discoverer = DiscovererFactory::create(cache: $cache, cacheTtl: 1800);
See examples for more
Please see CHANGELOG for more information on what has changed recently.
$ composer csfix # fix codestyle
$ composer checks # run all checks
# or separately
$ composer tests # run phpunit
$ composer phpstan # run phpstan
$ composer cs # run codesniffer
Please see CONTRIBUTING for details.
If you discover any security related issues, please email devs@digital.cz instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.