michaeld555/nfe-parser

A simple library to create fiscal danfe files

v1.0.3 2024-06-09 01:31 UTC

This package is auto-updated.

Last update: 2025-01-09 02:49:20 UTC


README

Installation

Run this composer command in your application:

composer require michaeld555/nfe-parser

Using

You can create a Danfe instance and pass the xml file path and output danfe file path. This will generate your document and save in your passed path.

    use Michaeld555\Danfe;

    Danfe::simple('path_to_file/nfe.xml', 'path_to_file/danfe.pdf');

    if (file_exists('path_to_file/danfe.pdf')) {

        echo "the file was generated successfully";

    } else {

        echo "an error occurred during the file generation";

    }

If you want to add your logo to the document, you can use the custom method passing the logo path.

    Danfe::custom('path_to_file/nfe.xml', 'path_to_file/danfe.pdf', 'path_to_logo/logo.png');

Notes:

  • If you are using a linux system, make sure you have python3 and the package brazilfiscalreport installed on your system, and that your application is enabled to execute customs python scripts