PHP code example of iprote / tcb-cms

1. Go to this page and download the library: Download iprote/tcb-cms 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/ */

    

iprote / tcb-cms example snippets


use Iprote\TcbCms\Facades\TCB;
use Iprote\TcbCms\Enums\AccountType;

$branch = TCB::branches()->create([
    'name' => 'Branch A',
    'code' => 'BR-A',
]);

TCB::branches()->addAccount($branch, [
    'account_name' => 'Collection Account',
    'account_number' => '173200000001',
    'profile_id' => '173200000001',
    'account_type' => AccountType::Collection,
    'is_default' => true,
]);

TCB::branches()->addAccount($branch, [
    'account_name' => 'Disbursement Account',
    'account_number' => '173200000002',
    'profile_id' => '173200000002',
    'account_type' => AccountType::Disbursement,
    'is_default' => true,
]);

$reference = TCB::createReference('BR-A', [
    'reference' => '999ABC123456789',
    'name' => 'John Doe',
    'mobile' => '255713999934',
    'message' => 'TUITION FEE',
]);

TCB::branch('BR-A')
    ->collectionAccount()
    ->createReference([
        'reference' => '999ABC123456789',
        'name' => 'John Doe',
        'mobile' => '255713999934',
        'message' => 'COLLECTION',
    ]);

TCB::branch('BR-A')
    ->disbursementAccount()
    ->disburse([
        'amount' => 500000,
        'reference' => 'LOAN-001',
        'description' => 'Loan disbursement',
    ]);

TCB::cancelReference('BR-A', '999ABC123456789');

TCB::reconciliation('BR-A', '2026-01-01', '2026-01-31');

$transaction = TCB::verifyPayment('999ABC123456789');

$token = TCB::authenticate();
$fsps = TCB::botFsps();
$lookup = TCB::accountLookup([
    'accountNo' => '110210001001',
    'institutionCode' => '048',
]);
$transfer = TCB::aggregatorPayment([
    'reference' => '9099959804450',
    'msisdn' => '2556578717069',
    'amount' => '390.00',
    'description' => 'TIPS transfer payment',
]);

use Iprote\TcbCms\Events\PaymentReceived;

Event::listen(PaymentReceived::class, function (PaymentReceived $event) {
    // Update order, loan, invoice, etc.
});
bash
php artisan vendor:publish --tag=tcb-config
php artisan vendor:publish --tag=tcb-migrations
php artisan migrate

POST /webhooks/tcb