PHP code example of medeirosdev / arquivei-nfe

1. Go to this page and download the library: Download medeirosdev/arquivei-nfe 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/ */

    

medeirosdev / arquivei-nfe example snippets


'providers' => [
    ...
    \MedeirosDev\Arquivei\Frameworks\Laravel\ArquiveiServiceProvider::class,
]

'aliases' => [
    ...
    'Arquivei' => \MedeirosDev\Arquivei\Frameworks\Laravel\Arquivei::class,
]

$license = new License($apiId, $apiKey);

$arquivei = new Arquivei;
$arquivei->setLicense($license);

// or Laravel framework license is auto generated

$request = new Arquivei;

$page = 0;

$response = (new Arquivei)
            ->setLicense($license)
            ->request($page);

// Get data with list NFe  
$response->data

// Or key access_key for first NFe
$response->data[0]->access_key

$response = (new Arquivei)->request();

$arquivei = new Arquivei;
$response = $arquivei->request();

$arquivei = new Arquivei;
$cursor = 0;
$response = $arquivei->request($cursor);
$listNfe = $arquivei->parse($response);

// Example Store implementing StoreInterface
class MyStore implements StoreInterface {
    public function store (XmlParser $nfe): bool
    {
        Storage::disk('local')->put($nfe->accessKey . '.xml', $nfe->xml);
        return true;
    }
}

$arquivei = new Arquivei;
$response = $arquivei->request();
$listNfe = $arquivei->parse($response);

$arquivei->setStore(new MyStore());
$store = $arquivei->store(...$ListNfe)

$arquivei = new Arquivei(new MyStore());
$response = $arquivei->request();
$listNfe = $arquivei->parse($response);

$store = $arquivei->store(...$ListNfe)

$arquivei = new Arquivei;
$responses = $arquivei->requestAll();

$arquivei = new Arquivei(new MyStore());
$responses = $arquivei->requestAllAndStore();