PHP code example of hytale-community / hytale-auth-php
1. Go to this page and download the library: Download hytale-community/hytale-auth-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/ */
hytale-community / hytale-auth-php example snippets
use HytaleCommunity\HytaleAuth\Configuration;
$configuration = new Configuration(
clientId: 'your-client-id',
redirectUri: 'https://example.com/auth/hytale/callback',
);
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\HttpFactory;
use HytaleCommunity\HytaleAuth\HytaleClient;
$httpClient = new Client();
$httpFactory = new HttpFactory();
$hytale = new HytaleClient(
configuration: $configuration,
httpClient: $httpClient,
requestFactory: $httpFactory,
streamFactory: $httpFactory,
);
use HytaleCommunity\HytaleAuth\Scope;
$authorization = $hytale->createAuthorizationRequest([
Scope::Profile,
Scope::GameOwnership,
]);