PHP code example of airtimerewards / ar-connect-sdk

1. Go to this page and download the library: Download airtimerewards/ar-connect-sdk 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/ */

    

airtimerewards / ar-connect-sdk example snippets




use AirtimeRewards\ARConnect\ARConnectClient;

$client = ARConnectClient::createClient('api-key', 'environment-id', $logger);



use AirtimeRewards\ARConnect\ARConnectClient;

$client = ARConnectClient::createClient('api-key', 'environment-id', $logger);

$networks = $client->getNetworks(); // returns a collection of networks
$filteredNetworks = $client->getNetworks('447700900000'); // returns a collection of networks for UK mobile number 07700 900 000



use AirtimeRewards\ARConnect\ARConnectClient;

$client = ARConnectClient::createClient('api-key', 'environment-id', $logger);
$creditTypes = $client->getCreditTypesForNetwork($network);



use AirtimeRewards\ARConnect\ARConnectClient;
use AirtimeRewards\ARConnect\Credit;
use Money\Money;
use Money\Currency;

$client = ARConnectClient::createClient('api-key', 'environment-id', $logger);
$creditValue = new Money(1000, new Currency('GBP')); // £10 of credit
$credit = $client->createCredit(
    '447700900000',
    $network,
    Credit::SUBSCRIPTION_TYPE_POSTPAID,
    $creditValue,
    true,
    'client-reference'
);