PHP code example of dazza-dev / laravel-dgt-cr

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


use DazzaDev\LaravelDgtCr\Facades\LaravelDgtCr;

$client = LaravelDgtCr::getClient();

// Emisor
$client->setIssuer([
    'identification_type' => '02',
    'identification_number' => 'identificacion_emisor',
]);

// Receptor
$client->setReceiver([
    'identification_type' => '02',
    'identification_number' => 'identificacion_receptor',
]);

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

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

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

$documentStatus = $client->checkStatus(
    documentKey: $clave
);

$document = $client->getDocument(
    documentKey: $clave
);

$documents = $client->getDocuments(
    offset: 0,
    limit: 50
);

use DazzaDev\LaravelDgtCr\Facades\LaravelDgtCr;

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

// Consultar los datos de un listado por tipo
$listingByType = LaravelDgtCr::getListing('tipos-comprobante');
bash
php artisan vendor:publish --tag="laravel-dgt-cr-config"
bash
php artisan vendor:publish --tag="laravel-dgt-cr-migrations"
bash
php artisan migrate
bash
php artisan dgt-cr:install