PHP code example of csfacturacion / csplug-php

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

    

csfacturacion / csplug-php example snippets


use Csfacturacion\CsPlug\CsPlugClient;

$client = CsPlugClient::create([
    'base_uri'  => 'https://csplug.csfacturacion.com', // Opcional, URI por defecto
    'username'  => 'tu_usuario',
    'password'  => 'tu_password',
]);

// Obtener una lista de CFDI's
$facturas = $client->cfdi()->list();

// Crear un CFDI
$cfdi = $client->cfdi()->create([
    // array con la estructura y detalles requeridos para el payload del CFDI
]);

use CsPlug;

// Utiliza CsPlug estáticamente tal como usarías un cliente
$emisores = CsPlug::emisoresHijos()->list();
bash
composer 
bash
php artisan vendor:publish --provider="Csfacturacion\CsPlug\Laravel\CsPlugServiceProvider"