PHP code example of rumbleh / laravel-ciot-antt

1. Go to this page and download the library: Download rumbleh/laravel-ciot-antt 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/ */

    

rumbleh / laravel-ciot-antt example snippets


use Rumbleh\CiotAntt\Facades\Ciot;
use Rumbleh\CiotAntt\Requests\DeclaracaoOperacaoTransporteRequest;
use Rumbleh\CiotAntt\Requests\Components\{Veiculo, OrigemDestino, Localidade, DadosCarga, InfPagamento, InfIndicadoresOperacionais};
use Rumbleh\CiotAntt\Enums\{TipoCarga, TipoPagamento};

$declaracao = DeclaracaoOperacaoTransporteRequest::cargaLotacao(
        cpfCnpjContratado: '11222333000181',
        rntrcContratado: '123456789',
        cpfCnpjContratante: '11444777000161',
    )
    ->comId('000000000123')                 // ou registre um OperationIdGenerator
    ->comValorFrete(1500.00)
    ->comDestinatario('19131243000197')
    ->comViagem(inicio: '2026-06-24', fim: '2026-06-28')
    ->comVeiculos(Veiculo::automotor(placa: 'ABC1234', numeroEixos: 2, rntrc: '123456789'))
    ->comOrigemDestino(
        OrigemDestino::entre(
            Localidade::origem()->comMunicipio(3550308),
            Localidade::destino()->comMunicipio(3304557),
        )->comDistancia(430),
    )
    ->comDadosCarga(new DadosCarga(codigoNaturezaCarga: 1234, pesoCarga: 25000, codigoTipoCarga: TipoCarga::CargaGeral))
    ->comPagamentos(new InfPagamento(
        tipoPagamento: TipoPagamento::ContaCorrente,
        cpfCnpjCreditado: '11222333000181',
        codigoInstituicaoFinanceira: 1, numeroAgencia: '1234', numeroConta: '56789-0',
    ))
    ->comIndicadores(new InfIndicadoresOperacionais());

$resposta = Ciot::declararOperacao($declaracao);

if ($resposta->sucesso()) {
    $ciot = $resposta->ciotComDigito();      // 16 dígitos (CIOT + DV)
} else {
    report("ANTT [{$resposta->codigo()}]: {$resposta->mensagem()}");
}

use Rumbleh\CiotAntt\Facades\GeradorCiot;

$numero   = GeradorCiot::gerarCiot('12345678901');        // CPF ou CNPJ
$consulta = GeradorCiot::consultarCiot('12345678000199'); // mesma API, payload de consulta