定制 medeirosdev/arquivei-nfe 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

medeirosdev/arquivei-nfe

Composer 安装命令:

composer require medeirosdev/arquivei-nfe

包简介

Arquivei NFe Getter

README 文档

README

This is a simple package that allows access to the Arquivei NFe API.

Information

Package create for Arquivei NFe

Documentation - https://docs.arquivei.com.br/?urls.primaryName=Arquivei%20API

Installation

Install the package using composer:

$ composer require medeirosdev/arquivei-nfe

Frameworks

At the moment we only have framework compatibility for Laravel. However, we welcome PRs to add further framework specific behavior as long as it doesn't prevent the package working for others

Laravel

If you are using Laravel then you can use our service provider. If you have Laravel >5.5 then the package will be auto discovered upon install. Else, add the following to your config/app.php file:

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

Facades

If you are using Laravel >5.5 then the facade will be automatically discovered. Else, you can add it in your config/app.php file.

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

Configuration

First, make sure you have copied the configuration file:

$ php artisan vendor:publish --tag=config --provider="MedeirosDev\Arquivei\Frameworks\Laravel\ArquiveiServiceProvider"

This will make a config/arquivei.php file, this is where your API Key / License information is fetched from. By default we use the .env configuration values to get your API key.

Use the App ID and App Code then you should add the following to your .env:

ARQUIVEI_BASE_URL=MY-BASE-URL
ARQUIVEI_VERSION=MY-API-VERSION
ARQUIVEI_API_ID=MY-API-ID
ARQUIVEI_API_KEY=MY-API-KEY

Please, make sure you don't store your keys in version control!

Usage

License / API Key

Before making requests you need to create your License object. You will need is your API key, then you can create your license as follows:

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

Then, you can start making your request:

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

// or Laravel framework license is auto generated

$request = new Arquivei;

Basic usage

$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

Basic usage in Laravel

No need to enter license object
$response = (new Arquivei)->request();

Supported Method

request

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

parse(int $cursor = 0)

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

store(XmlParser ...$listNfe)

// 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)

store(XmlParser ...$listNfe)

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

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

requestAll

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

requestAllAndStore

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

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-11-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固