PHP code example of bokbasen / php-sdk-auth

1. Go to this page and download the library: Download bokbasen/php-sdk-auth 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/ */

    

bokbasen / php-sdk-auth example snippets


 
 use Bokbasen\Auth\Login;
 use Symfony\Component\Cache\Adapter\FilesystemAdapter;
 try{
 	$cache = new FilesystemAdapter();
 	$auth = new Login('my_username', 'my_password', Login::URL_PROD, $cache);
	//If the TGT is cached, the SDK will only call the Bokbasen login server when the token is set to expire
 } catch(\Exception $e){
 	//error handling
 }

 
 use Bokbasen\Auth\Login;
 try{
 	//just an example, any client implementing \Http\Client\HttpClient\HttpClient will work
 	$client = new \Http\Adapter\Guzzle6\Client();
 	$auth = new Login('my_username', 'my_password', Login::URL_PROD, null, null, $client);
 } catch(\Exception $e){
 	//error handling
 }