PHP code example of dazza-dev / dian-feco

1. Go to this page and download the library: Download dazza-dev/dian-feco 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 / dian-feco example snippets


use DazzaDev\DianFeco\Client;

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

$client->setSoftware([
    'identifier' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
    'test_set_id' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
    'pin' => 'pin_software',
]);

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

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

$client->setDocumentType('invoice'); // Tipo de documento ('invoice', 'debit-note', 'credit-note')
$client->setDocumentData($documentData); // Datos del documento

$client->setTechnicalKey('clave_tecnica'); // Clave técnica (Solo para facturas)

$document = $client->sendDocument();

$numberingRange = $client->getNumberingRange('nit_emisor');

$events = $client->getStatusEvent('cufe/cude_documento');