1. Go to this page and download the library: Download mangati/sicoob-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/ */
mangati / sicoob-sdk example snippets
use Mangati\Sicoob\SicoobClient;
use Symfony\Component\HttpClient\HttpClient;
use Symfony\Component\HttpClient\HttpOptions;;
$localCert = "path/to/cert.pem";
$localPk = "path/to/cert.key";
$options = new HttpOptions();
$options
->setLocalCert($localCert)
->setLocalPk($localPk);
$client = HttpClient::create(
defaultOptions: $options->toArray(),
);
// pix
$sicoob = new SicoobPixClient($client);
// boleto
$sicoob = new SicoobCobrancaBancariaClient($client);
// conta corrente
$sicoob = new SicoobContaCorrenteClient($client);
use Mangati\Sicoob\SicoobCobrancaBancariaClient;
use Mangati\Sicoob\Dto\AuthenticationToken;
// Acesse https://developers.sicoob.com.br/portal/sandbox
// para pegar o "Client ID" e o "Access Token (Bearer)"
/** @var AuthenticationToken */
$token = SicoobCobrancaBancariaClient::sandboxToken(
clientId: '<sandbox-client-id>',
accessToken: '<sandbox-access-token>',
);
use Mangati\Sicoob\Dto\CobrancaBancaria\IncluirBoletoRequest;
use Mangati\Sicoob\Model\CobrancaBancaria\Boleto;
$auth = $sicoob->token(new TokenRequest(
clientId: $clientId,
scopes: [ TokenScope::COBRANCA_BOLETOS_INCLUIR ],
));
$response = $sicoob->incluirBoleto($auth->token, new IncluirBoletoRequest(
boleto: new Boleto(),
));
/** @var Boleto */
$boleto = $response->resultado;
$base64Data = $boleto->pdfBoleto;
$nossoNumero = $boleto->nossoNumero;