PHP code example of compufacil / api-sdk

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

    

compufacil / api-sdk example snippets


$cf = new Compufacil([
    'environment' => 'homolog',
    'version' => '1'
]);

$result = $cf->signIn('[email protected]', '123456');
print_r($result);

$revenues = $cf->rpcService('finance.get-revenue');
print_r($revenues); // []

$revenue = $cf->rpcService(
    'finance.post-revenue',
    [
        'description' => 'teste teste',
        'value' => 666
    ]
);
print_r($revenue); // ['id' => 152611]

$revenue = $cf->rpcService(
    'finance.get-revenue',
    [
        'id' => $revenue['íd']
    ]
);
print_r($revenue); // ['id' => 152611, 'description' => 'test...]

$revenue = $cf->rpcService(
    'finance.put-revenue',
    [
        'id' => $revenue['id'],
        'description' => 'teste update',
        'value' => 999
    ]
);
print_r($revenue); // ['id' => 152611]

$revenue = $cf->rpcService(
    'finance.delete-revenue',
    [
        'id' => $revenue['íd']
    ]
);
print_r($revenue); // ['id' => 152611]