1. Go to this page and download the library: Download effectra/third-party 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/ */
effectra / third-party example snippets
use Effectra\ThirdParty\LinkedIn;
$linkedin = new LinkedIn('YOUR_CLIENT_ID', 'YOUR_CLIENT_SECRET', 'YOUR_REDIRECT_URL', ['r_liteprofile', 'r_emailaddress']);
$authUrl = $linkedin->getAuthURL();
$code = $_GET['code']; // The authorization code obtained from the LinkedIn redirect
$accessToken = $linkedin->getAccessToken($code);
$user = $linkedin->getUser($accessToken);
use Effectra\ThirdParty\GitHub;
$github = new GitHub('YOUR_CLIENT_ID', 'YOUR_CLIENT_SECRET', 'YOUR_REDIRECT_URL', ['user']);
$authUrl = $github->getAuthURL();
$code = $_GET['code']; // The authorization code obtained from the GitHub redirect
$accessToken = $github->getAccessToken($code);
$user = $github->getUser($accessToken);
use Effectra\ThirdParty\Facebook;
$facebook = new Facebook('YOUR_CLIENT_ID', 'YOUR_CLIENT_SECRET', 'YOUR_REDIRECT_URL', ['email']);
$authUrl = $facebook->getAuthURL();
$code = $_GET['code']; // The authorization code obtained from the Facebook redirect
$accessToken = $facebook->getAccessToken($code);
$user = $facebook->getUser($accessToken);
use Effectra\ThirdParty\Google;
$google = new Google('YOUR_CLIENT_ID', 'YOUR_CLIENT_SECRET', 'YOUR_REDIRECT_URL', ['profile', 'email']);
$authUrl = $google->getAuthURL();
$code = $_GET['code']; // The authorization code obtained from the Google redirect
$accessToken = $google->getAccessToken($code);
$user = $google->getUser($accessToken);
namespace Effectra\ThirdParty;
class MyOAuthService implements OAuthServiceInterface
{
// Implement the getConfig() method
public function getConfig(): array
{
// Return the configuration array for the OAuth service
}
// Implement the getAuthURL() method
public function getAuthURL(): string
{
// Return the authorization URL for the OAuth service
}
// Implement the getAccessToken() method
public function getAccessToken(string $code): string
{
// Get the access token for the OAuth service using the authorization code
}
// Implement the getUser() method
public function getUser(string $token): ?array
{
// Get the user data from the OAuth service using the access token
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.