2017 © Pedro PelĂĄez
 

library cfdi-wrapper

Simple wrapper to interact with a CFDI without XSD hassle.

image

zzantares/cfdi-wrapper

Simple wrapper to interact with a CFDI without XSD hassle.

  • Sunday, November 5, 2017
  • by ZzAntares
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

CFDI Wrapper

Build Status Code Coverage, (*1)

This project is a neat wrapper for CFDI XSD files, this library allows you to manipulate CFDI attributes in a very simple and intuitive way without dealing with XML, XSD or XPATH at all!, (*2)

Instalation

Add the dependency to your composer.json:, (*3)

{
    "require": {
        "zzantares/cfdi-wrapper": "dev-master",
    }
}

Now just run composer install or composer update depending on the stage of your project, (*4)

Usage

In order to use the CFDI Wrapper advantages create an instance of the Cfdi class by passing the XML content of the CFDI to inspect:, (*5)

<?php

require 'vendor/autoload.php';

use ZzAntares\CfdiWrapper\Cfdi;

$xmlContent = file_get_contents('/path/to/cfdi.xml');
$cfdi = new Cfdi($xmlContent);

echo $cfdi->emisor->rfc;  // 'some123456rfc'

It is also possible to create an instance from a path file, like this:, (*6)

<?php

require 'vendor/autoload.php';

use ZzAntares\CfdiWrapper\Cfdi;

$cfdi = new Cfdi('/path/to/cfdi.xml');

Available attributes

'version',
'serie',
'folio',
'fecha',
'subTotal',
'subtotal',  // Alias of subTotal
'total',
'certificado' ,
'noCertificado',
'condicionesDePago',
'descuento',
'motivoDescuento',
'TipoCambio',
'tipoCambio',  // Alias of TipoCambio
'Moneda',
'moneda',  // Alias of Moneda
'metodoDePago',
'sello' ,
'tipoDeComprobante',
'formaDePago',
'LugarExpedicion',
'lugarExpedicion',  // Alias of LugarExpedcion
'NumCtaPago',
'numCtaPago',  // Alias of numCtaPago

Also you can access to the nested objects:, (*7)

'emisor',
'receptor',
'conceptos',
'impuestos',
'impuestosLocales',
'timbreFiscalDigital',
'timbre',  // Alias of timbreFiscalDigital

Every one of this nested objects has it's own attributes, you can get them very intuitively by reading the CFDI XSD file, here are some common examples:, (*8)

<?php

$cfdi->folio;
$cfdi->fecha;
$cfdi->emisor->rfc;
$cfdi->emisor->nombre;
$cfdi->emisor->domicilio->calle;
$cfdi->receptor->rfc;
$cfdi->receptor->nombre;
$cfdi->receptor->domicilio->calle;
$cfdi->timbre->uuid;
$cfdi->conceptos;  // Is an array
$cfdi->conceptos[0]->descripcion;

The Versions

05/11 2017

dev-master

9999999-dev http://git.microbit.com/julio/cfdi-wrapper

Simple wrapper to interact with a CFDI without XSD hassle.

  Sources   Download

MIT

The Requires

 

The Development Requires

by César Antåres

xml wrapper xsd sat cfdi facturas