Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jansenfelipe/nfephp-serialize
Transforme NFe(xml) em objetos PHP e vice-versa
https://github.com/jansenfelipe/nfephp-serialize
nfe
Last synced: 3 days ago
JSON representation
Transforme NFe(xml) em objetos PHP e vice-versa
- Host: GitHub
- URL: https://github.com/jansenfelipe/nfephp-serialize
- Owner: jansenfelipe
- Created: 2014-11-11T20:02:07.000Z (almost 10 years ago)
- Default Branch: 3.10
- Last Pushed: 2016-01-08T11:57:34.000Z (almost 9 years ago)
- Last Synced: 2024-10-28T23:52:11.519Z (11 days ago)
- Topics: nfe
- Language: PHP
- Homepage: http://jansenfelipe.github.io/nfephp-serialize
- Size: 578 KB
- Stars: 69
- Watchers: 16
- Forks: 23
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-brasil - NFePHP Serialize - versa). | (PHP / Packages)
README
# NFePHP Serialize 3.10
[![Travis](https://travis-ci.org/jansenfelipe/nfephp-serialize.svg?branch=3.10)](https://travis-ci.org/jansenfelipe/nfephp-serialize)
[![Latest Stable Version](https://poser.pugx.org/jansenfelipe/nfephp-serialize/v/stable.svg)](https://packagist.org/packages/jansenfelipe/nfephp-serialize)
[![Total Downloads](https://poser.pugx.org/jansenfelipe/nfephp-serialize/downloads.svg)](https://packagist.org/packages/jansenfelipe/nfephp-serialize)
[![Latest Unstable Version](https://poser.pugx.org/jansenfelipe/nfephp-serialize/v/unstable.svg)](https://packagist.org/packages/jansenfelipe/nfephp-serialize)
[![MIT license](https://poser.pugx.org/jansenfelipe/nfephp-serialize/license.svg)](http://opensource.org/licenses/MIT)Transforme NFe(xml) em objetos PHP e vice-versa
Compatível com a NFe 3.10 - Pacote de Liberação No. 8f (09/10/2014)
Documentação: [http://jansenfelipe.github.io/nfephp-serialize](http://jansenfelipe.github.io/nfephp-serialize/)
### Como utilizar
Adicione a library
```sh
$ composer require jansenfelipe/nfephp-serialize
```Adicione o autoload.php do composer no seu arquivo PHP.
```php
require_once 'vendor/autoload.php';
```### Serialize
Chame o método `xmlToObject` passando a string xml para transformá-la em um objeto `NfeProc`
```php
$nfeProc = NFePHPSerialize::xmlToObject(file_get_contents('nfe.xml'));
```##### Exemplos
```php
//Capturando CNPJ do emitente
$cnpjEmitente = $nfeProc->getNFe()->getInfNFe()->getEmit()->getCNPJ();//Capturando endereço do destinatário
$endereco = $nfeProc->getNFe()->getInfNFe()->getDest()->getEnderDest();
```### Deserialize
Chame o método `objectToXml` passando o objeto `NfeProc` para transformá-la em uma string xml
```php
$xml = NFePHPSerialize::objectToXml(new NfeProc());
```### Gostou? Conheça também
* [CnpjGratis](https://github.com/jansenfelipe/cnpj-gratis)
* [CpfGratis](https://github.com/jansenfelipe/cpf-gratis)
* [CepGratis](https://github.com/jansenfelipe/cep-gratis)
* [CidadesGratis](https://github.com/jansenfelipe/cidades-gratis)### License
The MIT License (MIT)