PHP code example of developer-api / ibscbs-client
1. Go to this page and download the library: Download developer-api/ibscbs-client 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/ */
developer-api / ibscbs-client example snippets
DeveloperApi\IbsCbs\IbsCbsClient;
$client = new IbsCbsClient();
$nota = [
'data_emissao' => '2025-07-15',
'numero' => '123',
'serie' => '1',
'cnpj_emitente' => '12345678000199',
'cnpj_cliente' => '99887766000155',
'valor_total' => 100.00,
];
$items = [
[
'codigo' => '001',
'descricao' => 'Produto X',
'ncm' => '22030000',
'cfop' => '5102',
'quantidade' => 1,
'valor_unitario' => 100.00,
'valor_total' => 100.00,
'ibs_classificacao' => '000001',
'ibs_cst' => '000',
],
];
try {
$resultado = $client->calcular($nota, $items, 'SP', 'MT');
echo '<pre>';
print_r($resultado);
echo '</pre>';
} catch (\Throwable $e) {
echo 'Erro na API IBS/CBS: ' . $e->getMessage();
}
try {
$resultado = $client->calcular($nota, $items, 'SP', 'SP');
} catch (\RuntimeException $e) {
// trate erro de chamada/HTTP/JSON
echo $e->getMessage();
}
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://modelotributacao.developerapi.com.br/ibscbs/json',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => '{
"nota": {
"data_emissao": "2025-07-15",
"numero": "123",
"serie": "1",
"cnpj_emitente": "12345678000199",
"cnpj_cliente": "99887766000155",
"valor_total": 100
},
"items": [
{
"codigo": "001",
"descricao": "Produto X",
"ncm": "22030000",
"cfop": "5102",
"quantidade": 1,
"valor_unitario": 100,
"valor_total": 100,
"ibs_classificacao": "000001",
"ibs_cst": "000"
}
],
"ufEmitente": "SP",
"ufCliente": "MT"
}',
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Accept: application/json',
],
]);
$response = curl_exec($curl);
if ($response === false) {
echo 'Erro cURL: ' . curl_error($curl);
} else {
echo $response;
}
curl_close($curl);