PHP code example of blacktrue / sat-cfdi

1. Go to this page and download the library: Download blacktrue/sat-cfdi 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/ */

    

blacktrue / sat-cfdi example snippets




use Blacktrue\CfdiValidator\Validator;

$satValidator = new Validator();

$response = $satValidator->setRfcEmisor('BMN930209927')
    ->setRfcRecpetor('AUAC920422D38')
    ->setUuid('B80052EB-3C91-4842-BA3C-DAEEDAC51F31')
    ->setPhantomBin('phantomjs')
    ->validate();
    
echo $response->getMessage(); //"Comprobante obtenido satisfactoriamente", "Recurso no encontrado, intente mas tarde."
echo $response->getEstate(); //No encontrado, Vigente, Cancelado
echo $response->getFechaCancelacion(); //Si es cancelacion

echo $satValidator->generateImage() //Imagen en base64