PHP code example of carlosocarvalho / sigis-php-sdk

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

    

carlosocarvalho / sigis-php-sdk example snippets




use CarlosOCarvalho\Sigiss\Drivers\Barretos;
use CarlosOCarvalho\Sigiss\Provider;
use CarlosOCarvalho\Sigiss\SigissService;



$config = new Barretos([
    'name' => 'Razao Social',
    'description' => '',
    'phone' => '(17) 3322-3777',
    'ccm' => '15556',//ccm 
    'document' => '******', //cnpj
    'password' => '****', // password
    'crc' => '******', // contador crc
    'crc_state' => 'SP', 
    'url' => 'https://barretos.sigiss.com.br/barretos/ws/sigiss_ws.php?wsdl',
    'simple_rate' => '2,8900%',// calculo aliquota
    'code_service' => 801, // codigo do servico
    'condition' =>  'T', // situacao


]);
$provider = new Provider($config); /// provider use in SigIssService




use CarlosOCarvalho\Sigiss\Drivers\Barretos;
use CarlosOCarvalho\Sigiss\Provider;
use CarlosOCarvalho\Sigiss\SigissService;




$service  =  new SigissService($provider);
$service->params(['nota' =>  '3342', 'serie' => 1, 'autenticidade' => 'WFTS0BT8', 'valor' => '10,60'])->search();
$service->fire();




use CarlosOCarvalho\Sigiss\Drivers\Barretos;
use CarlosOCarvalho\Sigiss\Provider;
use CarlosOCarvalho\Sigiss\SigissService;


$provider = new Provider($config);
$service  =  new SigissService($provider);

$data  = [
    'valor' => '10,6',
    'base'  => '10,6',
    'descricaoNF' => 'Apenas uma descricao de uma nota teste',
    'tomador_tipo' => 2,
    'tomador_cnpj' => '*****', //cnoj da empresa
    'tomador_email' => '[email protected]',
    'tomador_razao' => 'Jose Maria dos Santos',
    'tomador_endereco' => 'Avenida Maria Trindade',
    'tomador_numero' => '2367',
    'tomador_bairro' => 'Paulista Nova',
    'tomador_CEP' => '08343320',
    'tomador_cod_cidade' => 'Barretos',
    'rps_num' => '2543122',
    'id_sis_legado' => '2543122',
    'rps_serie' => 1,
    'serie' => 1

    
];
try{
  
  $service->params($data)->create();
  $response = $service->fire();
  dump($response);
}catch(\Exception $e){
    dump($e->getMessage());
}




use CarlosOCarvalho\Sigiss\Drivers\Barretos;
use CarlosOCarvalho\Sigiss\Provider;
use CarlosOCarvalho\Sigiss\SigissService;


$data = [
    'nota'=> 3338,
    'email' => '[email protected]',
    'motivo' => 'Nota de teste para criacao do SDK'
    
];
try{
    $service->params($data)->cancel();
   $response = $service->fire();
}catch(\Exception $e){
    dump($e->getMessage());
}