PHP code example of leandronunes07 / c6bank-php-sdk
1. Go to this page and download the library: Download leandronunes07/c6bank-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/ */
leandronunes07 / c6bank-php-sdk example snippets
use LeandroNunes\C6Bank\C6Bank;
$c6 = new C6Bank([
'client_id' => 'YOUR_CLIENT_ID',
'client_secret' => 'YOUR_CLIENT_SECRET',
'certificate' => '/path/to/cert.pem', // Required for Production
'private_key' => '/path/to/key.pem', // Required for Production
'sandbox' => true
]);
// 1. Get Account Balance
try {
$account = $c6->accounts()->getAccount('account-id');
echo "Balance: {$account->balance}";
} catch (\Exception $e) {
echo "Error: " . $e->getMessage();
}
use LeandroNunes\C6Bank\C6Bank;
use Symfony\Component\Cache\Adapter\RedisAdapter;
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
// 1. Setup PSR-16 Cache (Example with Symfony Cache)
$cache = new RedisAdapter($redisConnection); // or FilesystemAdapter
// 2. Setup PSR-3 Logger (Example with Monolog)
$logger = new Logger('c6bank');
$logger->pushHandler(new StreamHandler('configs/c6bank.log', Logger::WARNING));
// 3. Initialize SDK
$c6 = new C6Bank([
'client_id' => $_ENV['C6_CLIENT_ID'],
'client_secret' => $_ENV['C6_CLIENT_SECRET'],
'certificate' => '/path/to/cert.pem',
'private_key' => '/path/to/key.pem',
'sandbox' => false,
// Inject Dependencies
'cache' => $cache,
'logger' => $logger
]);
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.