PHPackages                             nfe-easy/nfe-easy - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. nfe-easy/nfe-easy

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

nfe-easy/nfe-easy
=================

Easy package to manage NFe resources

06PHP

Since Jan 4Pushed 9y ago1 watchersCompare

[ Source](https://github.com/bfgasparin/NFeEasy)[ Packagist](https://packagist.org/packages/nfe-easy/nfe-easy)[ RSS](/packages/nfe-easy-nfe-easy/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

NFeEasy
=======

[](#nfeeasy)

Introduction
------------

[](#introduction)

NFeEasy is a wrapper to manage NFe files.

Requirements
------------

[](#requirements)

- PHP 7.0.13 or later

Instalation
-----------

[](#instalation)

### Composer

[](#composer)

You and install via composer:

```
$ composer require nfe-easy/nfe-easy

```

and use composer autoload:

```
require_once('vendor/autoload.php');
```

### Manual Instalation

[](#manual-instalation)

If you don't want to use Composer, download the latest version of **NefEasy** and include the `init.php` file:

```
require_once('/path/to/nfeasy/init.php');
```

You will also need to dowload the **NfeEasy** php dependencies and autoload then manually. See `composer.json` to see NfeEasy dependencies.

How to use
----------

[](#how-to-use)

To use the NfeEasy, just pass the xml nfe file content to the XmlInvoiceBuilder and it will returns the PHP objects representing the given NFe.

```
XmlInvoiceBuilder::::create(
    file_get_contents('path/to//my/invoice.xml')
); // returns an instance of NFeEasy\Invoice
```

Domain Objects
--------------

[](#domain-objects)

Each Domain from NFe file is represented by an NFeEasy object class. These classes are called **Domain Object Classes**.

The list of Domains Object Classes includes:

- `NFeEasy\Invoice`
- `NFeEasy\Product`
- `NFeEasy\Emitter`
- `NFeEasy\Receiver`
- `NFeEasy\Address`

A full `NFe` file is represented by a relationship between one or more **NFeEasy Domain Objects Classes**.

The NFeEasy Domain Object Classes contain the data extracted from the NFe file. The data is diviled between the NfeEasy Domain Object Classes.

For a full NfeEasy reprentation, use the `NFeEasy\Builder\XmlInvoiceBuilder::create` method. It will return an `NFeEasy\Invoice` instance.

### Invoice

[](#invoice)

The `NFeEasy\Invoice` represents the NFe file itself, and contains data to indentity the NFe.

All other Domain Object Classes resides below `Invoice` Object.

The table bellow describes all attributes you can access from `NFeEasy\Invoice` class:

AttributeTypeDescription`cUF`string`cNF`stringTransaction Nature Id`natOp`stringTransaction Nature Description`indPag`stringPayment Id (0 = Entrada / 1 = Saída)`mod`string`serie`stringInvoice Serie`nNF`stringInvoice Number`dhEmi`stringEmission Date`tpNF`stringInvoice Type Id`idDest`string`cMunFG`string`tpImp`string`tpEmis`string`cDV`string`tpAmb`string`finNFe`string`indFinal`string`indPres`string`procEmi`string`verProc`stringVersion`products`Collection(Product)A list of `Product` for this Invoice`additionalInfo`stringAddicional Information`emitter`EmitterThe Invoice `Emitter``receiver`ReceiverThe Invoice `Receiver`### Product

[](#product)

`NFeEasy\Product` represents an Invoice`s product. It contains informations like the name of the product, the NCM, the value, the quantity the taxes, and other product related things.

The table bellow describes all attributes you can access from `NFeEasy\Product` class:

AttributeTypeDescription`cProd`stringProduct Id`cEAN`string`xProd`stringProduct Description`NCM`stringNomenclatura Comum do Mercosul / Sistema Harmonizado`CEST`string`CST`stringTable CST - ICMS`CFOP`stringCodigo Fiscal de Operações e Prestações`uCom`stringInvoice Number`qCom`stringEmission Date`vUnCom`stringInvoice Type Id`vProd`stringProduct Value`cEANTrib`string`uTrib`stringUnit Type (UN, CX)`qTrib`string`vUnTrib`stringUnit Value`indTot`stringTotal Value (nItemPed\*intTotal)`xPed`string`nItemPed`stringQuantity`nFCI`stringEmitter
-------

[](#emitter)

`NFeEasy\Emitter` represents the NFe emitter

The table bellow describes all attributes you can access from `NFeEasy\Product` class:

AttributeTypeDescription`CNPJ`stringThe CNPJ`xNome`stringThe Emitter name`xFant`stringTrading name`IE`string`IEST`string`CRT`string`address`AddressThe Emitter AddressReceiver
--------

[](#receiver)

`NFeEasy\Receiver` represents the NFe Receiver

The table bellow describes all attributes you can access from `NFeEasy\Product` class:

AttributeTypeDescription`CNPJ`stringThe CNPJ`xNome`stringThe Receiver name`IE`string`indIEDest`string`address`AddressThe Receiver AddressAddress
-------

[](#address)

`NFeEasy\Address` represents an address object

The table bellow describes all attributes you can access from `NFeEasy\Address` class:

AttributeTypeDescription`xLgr`stringThe Street name`nro`stringthe Street number`xBairro`stringThe Neighborhood name`cMun`stringThe District Code`xMun`stringThe Destrict name`UF`stringThe District`CEP`stringThe CEP`cPais`stringThe Country Code`xPais`stringThe Country Name`fone`stringThe phone numberCreating Domain Objects
-----------------------

[](#creating-domain-objects)

You can create Domain Object classes individually. Just use the method `created` from the respective object passing the parameters you wnat to populate into the object:

```
$address = Address::create([
    'xLgr' => 'Some address street',
    'nro' => '207'
]); // returns an NFeEasy\Address
```

If you dont't want to create the domain objects individually, you can pass all data directy to the `NfeEasy\Invoice`:

```
$invoice = Invoice::create([
    'cUF' => '32',
    'natOp' => 'Venda Sub / Venda Mer',
    'addicionalInfo' => 'Some Info',
    // ...
    'emitter' => [
        'xNome' => 'Emitter Name',
        'CNPJ' => '23740049120232'
        // ...
    ],
    'receiver' => [
        'xNome' => 'Receiver Name',
        'CNPJ' => '40193549120112'
        // ...
    ],
    'products' => [
        [
            'cProd' => '13'
            'xProd' => 'Shampoo'
            // ...
        ],
        [
            'cProd' => '345'
            'xProd' => 'Soap'
            // ...
        ],
        // ...
    ]
]); // returns an NFeEasy\Invoice
```

Attributes
----------

[](#attributes)

After a Domain Object is created, you can access the data by access attributes by its names:

```
$product = Product::create([
    'cProd' => '12'
    'xProd' => 'Notebook'
]);

echo $product->xProd; // prints 'Shampoo'
```

You can access child objects by the attributes names too:

```
$emitter = Emitter::create([
    'xNome' => 'Andrew'
    'CNPJ' => '23740049120232',
    'address' => [
        'xLgr' => 'Rua Ivaí',
        'nro' => 207,
        'xBairro' => 'Tatuapé'
    ],
]);

$emitter->address;  // returns an instance of NfeEasy\Address;

echo $emitter->address->xBairro; prints 'Tatuapé'
```

Collections
-----------

[](#collections)

Array of Domain Objects are treated as Collections into NfeEasy. All Object Collections are represented by an instance of `Illuminate\Support\Collection`.

Collections in NfeEasy are used for:

- `products` attribute into `Invoice` Object

For example, to return the collection of products from an Invoice, use:

```
$products $invoice->products;  // Return an instance of `Illuminate\Support\Collection`.
```

To filter products with value greater than 20, use:

```
$products = $invoice->products->filter(function ($product, $key){
    return $product->vProd > 20;
});
```

For all `Illuminate\Support\Collection` available methods, see [Illuminate Collection Docs](https://laravel.com/docs/5.3/collections#method-filter).

Serialization
-------------

[](#serialization)

All Domain objects implements `Illuminate\Contracts\Support\Arrayable` and `Illuminate\Contracts\Support\Arrayable\Jsonable`.

So you can transform the all NfeEasy Domain objects easily:

```
$invoice => Invoice::create([
    // attributes data
]);

$invoice->toArray(); // converts the domains objects into arrays

$invoice->toJson(); // converts the domains objects into a json string

(string)$invoice; // converts the domains objects into a json string
```

Tests
-----

[](#tests)

NfeEasy uses [PHPUnit](https://phpunit.de) unit tests for better reliablility and security.

To run all tests, justs go to the project folder and type:

```
$ phpunit

```

\##License

NfeEasy is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/036ca3436e5b296ee1497e86e599f083b689849a396263da2c6575938d570d86?d=identicon)[bfgasparin](/maintainers/bfgasparin)

---

Top Contributors

[![bfgasparin](https://avatars.githubusercontent.com/u/4076928?v=4)](https://github.com/bfgasparin "bfgasparin (19 commits)")

---

Tags

nfephp

### Embed Badge

![Health badge](/badges/nfe-easy-nfe-easy/health.svg)

```
[![Health](https://phpackages.com/badges/nfe-easy-nfe-easy/health.svg)](https://phpackages.com/packages/nfe-easy-nfe-easy)
```

###  Alternatives

[fbf/laravel-youtube

A Laravel package to upload videos to a YouTube channel

954.2k](/packages/fbf-laravel-youtube)[quadrubo/filament-model-settings

This is my package filament-model-settings

1637.5k](/packages/quadrubo-filament-model-settings)[typicms/bootforms

Just a Formbuilder with some Bootstrap 5 specific conveniences. Remembers old input, retrieves error messages and handles all your boilerplate Bootstrap markup automatically.

1256.0k2](/packages/typicms-bootforms)[zmoyi/jstan

聚水潭-php-sdk

153.8k1](/packages/zmoyi-jstan)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
