csb / php
CSB Package for PHP applications.
Installs: 10 876
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=5.4
- ext-curl: *
- ext-dom: *
- ext-json: *
Requires (Dev)
- phpunit/phpunit: >=4
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']);
User [user($accountID, $userID, $attributes = [])]
$CSB->user('Account1', 'User1', ['attribute_1' => 'value1', 'attribute_2' => 'value2', 'custom_Field' => 'custom_value']);
Subscription [subscription($accountID, $subscriptionID, $attributes = [])]
$CSB->subscription('Account1', 'Subscription1', ['attribute_1' => 'value1', 'attribute_2' => 'value2']);
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']);
Feature [feature($accountID, $userID, $productID, $moduleID, $featureID, $total = 1)]
To Send Features to CSB
$CSB->feature('Account1', 'User1', 'ProductName', 'ModuleName', 'FeatureName');