1. Go to this page and download the library: Download tykfyr/openid-connect-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tykfyr / openid-connect-php example snippets
use Tykfyr\OpenIDConnect\Client;
// Initialize the client
$oidc = new Client(
'https://your-identity-provider.com',
'your-client-id',
'your-client-secret'
);
// Set the redirect URI
$oidc->setRedirectUri('https://your-app.com/callback');
// Start authentication
$oidc->authenticate();
// In your callback handler
$oidc->handleCallback();
// Get user information
$userInfo = $oidc->requestUserInfo();
$email = $oidc->requestUserInfo('email');
// Configure SSL verification
$oidc->setVerifyHost(false); // Disable host verification (not recommended for production)
$oidc->setVerifyPeer(false); // Disable peer verification (not recommended for production)
// Set custom certificate path
$oidc->setCertPath('/path/to/cert.pem');
// Configure proxy
$oidc->setHttpProxy('http://proxy.example.com:8080');
// Set custom scopes
$oidc->setScopes(['openid', 'profile', 'email', 'custom_scope']);
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.