csb/php

CSB Package for PHP applications.

2.0.3 2021-01-04 11:04 UTC

This package is auto-updated.

Last update: 2025-08-04 22:09:23 UTC


README

Requirements

php >= 5.4

Install Package

composer require csb/php -vvv --no-scripts --optimize-autoloader --ansi

Update Package

composer update csb/php -vvv --no-scripts --optimize-autoloader --ansi

Initiate Package

For Laravel, Add this Code to register function of AppServiceProvider.php
$this->app->singleton('csb', function () {
    return new CSB(
        'https://{{domain}}.customersuccessbox.com',
        '{{secret}}',
        'async'
    );
});

$CSB = app('csb');
For PHP, Simply make singleton object, valid throughout request
$CSB = new CSB(
    'https://{{domain}}.customersuccessbox.com',
    '{{secret}}',
    'async'
);
Note: We can use 'async' for Linux Systems only, For Windows Systems use 'sync'

Functions

Login
$CSB->login('Account1', 'User1');
Logout
$CSB->logout('Account1', 'User1');
Account [account($accountID, $attributes = [])]
$CSB->account('Account1', ['attribute_1' => 'value1', 'attribute_2' => 'value2', 'custom_Field' => 'custom_value']);

Account Properties

User [user($accountID, $userID, $attributes = [])]
$CSB->user('Account1', 'User1', ['attribute_1' => 'value1', 'attribute_2' => 'value2', 'custom_Field' => 'custom_value']);

User Properties

Subscription [subscription($accountID, $subscriptionID, $attributes = [])]
$CSB->subscription('Account1', 'Subscription1', ['attribute_1' => 'value1', 'attribute_2' => 'value2']);

Subscription Properties

Invoice [invoice($accountID = null, $subscriptionID = null, $invoiceID, $attributes = [])]
$CSB->invoice('Account1', null, 'Invoice1', ['attribute_1' => 'value1', 'attribute_2' => 'value2']);
$CSB->invoice(null, 'Subscription1', 'Invoice1', ['attribute_1' => 'value1', 'attribute_2' => 'value2']);

Invoice Properties

Feature [feature($accountID, $userID, $productID, $moduleID, $featureID, $total = 1)]
To Send Features to CSB
$CSB->feature('Account1', 'User1', 'ProductName', 'ModuleName', 'FeatureName');

Feature Properties