PHP code example of dazza-dev / sri-ec

1. Go to this page and download the library: Download dazza-dev/sri-ec 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/ */

    

dazza-dev / sri-ec example snippets


use DazzaDev\SriEc\Client;

$client = new Client(test: true); // true or false

$client->setCertificate([
    'path' => _DIR_ . '/certificado.p12',
    'password' => 'clave_certificado',
]);

// Ruta donde se guardarán los archivos xml
$client->setFilePath(_DIR_ . '/sri');

// Usar el valor en inglés de la tabla
$client->setDocumentType('invoice');

// Datos del documento
$client->setDocumentData($documentData);

// Enviar el documento
$document = $client->sendDocument();

use DazzaDev\SriEc\Listing;

// Obtener los listados disponibles
$listings = Listing::getListings();

// Consultar los datos de un listado por tipo
$listingByType = Listing::getListing('identification-types');