1. Go to this page and download the library: Download finaegis/php-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/ */
finaegis / php-sdk example snippets
FinAegis\Client;
// Initialize the client
$client = new Client('your-api-key', [
'environment' => 'sandbox' // or 'production'
]);
// List accounts
$accounts = $client->accounts->list();
foreach ($accounts->data as $account) {
echo $account->getName() . ": $" . ($account->getBalance() / 100) . "\n";
}
// Create a new account
$account = $client->accounts->create(
'user-uuid',
'My Savings Account',
10000 // Initial balance in cents
);
// Make a transfer
$transfer = $client->transfers->create(
'from-account-uuid',
'to-account-uuid',
5000, // Amount in cents
'USD',
'Payment for services'
);
$client = new Client('your-api-key', [
'environment' => 'production', // 'production' | 'sandbox' | 'local'
'timeout' => 30, // Request timeout in seconds
'max_retries' => 3, // Number of retries for failed requests
'base_url' => null, // Custom API base URL (optional)
'logger' => $logger // PSR-3 compatible logger (optional)
]);
$client = new Client(''); // Will use FINAEGIS_API_KEY env var
// Get GCU information
$gcu = $client->gcu->getInfo();
// Get real-time composition
$composition = $client->gcu->getComposition();
foreach ($composition->getComposition() as $asset) {
echo "{$asset['asset_code']}: {$asset['percentage_of_basket']}%\n";
}
// Get value history
$history = $client->gcu->getValueHistory('7d', 'daily');
// Get active governance polls
$polls = $client->gcu->getActivePolls();
// Get supported banks
$banks = $client->gcu->getSupportedBanks();
function monitorAccountActivity($client, $accountId) {
// Get recent transactions
$transactions = $client->accounts->getTransactions($accountId, 1, 10);
echo "Recent transactions for account {$accountId}:\n";
foreach ($transactions->data as $tx) {
$sign = $tx->getType() === 'deposit' ? '+' : '-';
$amount = $tx->getAmount() / 100;
echo "{$tx->created_at}: {$sign}\${$amount} - {$tx->getStatus()}\n";
}
// Get recent transfers
$transfers = $client->accounts->getTransfers($accountId, 1, 10);
echo "\nRecent transfers:\n";
foreach ($transfers->data as $transfer) {
$amount = $transfer->getAmount() / 100;
if ($transfer->getFromAccount() === $accountId) {
echo "{$transfer->created_at}: Sent \${$amount} to {$transfer->getToAccount()}\n";
} else {
echo "{$transfer->created_at}: Received \${$amount} from {$transfer->getFromAccount()}\n";
}
}
}
function exchangeCurrency($client, $accountId, $fromCurrency, $toCurrency, $amount) {
// Get exchange rate
$rate = $client->exchangeRates->get($fromCurrency, $toCurrency);
echo "Exchange rate: 1 {$fromCurrency} = {$rate->getRate()} {$toCurrency}\n";
// Calculate conversion
$conversion = $client->exchangeRates->convert($fromCurrency, $toCurrency, $amount);
echo "Converting {$amount} {$fromCurrency} = {$conversion['to_amount']} {$toCurrency}\n";
// Perform the exchange (assuming you have an exchange endpoint)
// This is just an example - actual implementation may vary
return $conversion;
}
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.