PHP code example of nascom / itsme-api-client

1. Go to this page and download the library: Download nascom/itsme-api-client 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/ */

    

nascom / itsme-api-client example snippets




use Nascom\ItsmeApiClient\Http\ApiClient\ApiClient;
use Nascom\ItsmeApiClient\Http\ApiClient\Service;
use Nascom\ItsmeApiClient\Http\ApiClient\ApiClientFactory;

$guzzleClient = new \GuzzleHttp\Client(['base_uri' => Service::PRODUCTION]);
$client = new ApiClient($guzzleClient);

// Alternatively, you can use the ApiClientFactory.
$client = ApiClientFactory::production();



use Nascom\ItsmeApiClient\Request\Transaction\CreateTransactionRequest;

$transactionRequest = new CreateTransactionRequest($token, $service, $redirectUrl);
$transaction = $client->handle($transactionRequest);

echo $transaction->getAuthenticationUrl();



use Nascom\ItsmeApiClient\Request\Status\RetrieveStatusRequest;

$statusRequest = new RetrieveStatusRequest($_SESSION['token']);
$status = $client->handle($statusRequest);

echo $status->getEmailAddress();