hazzo/laravel-afip-wrapper 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

hazzo/laravel-afip-wrapper

Composer 安装命令:

composer require hazzo/laravel-afip-wrapper

包简介

Afip Web Service wrapper for Laravel

README 文档

README

AFIP technical documentation for their Web Service AFIP Web Service

Installation

Type in your terminal:

composer require hazzo/LaravelAfipWrapper

Register AfipWrapper by adding it to the service providers on the app.php.

'providers' => array(
        ...
        hazzo\LaravelAfipWrapper\Providers\AfipWsServiceProvider::class
    )

Let's add the facade in the bottom of the same file in aliases.

'aliases' => array(
        ...
        'AfipWS' => hazzo\LaravelAfipWrapper\Facades\AfipWs::class,
    )

Publish the package configuration file.

php artisan vendor:publish --provider="hazzo\laravel-afip-wrapper\Providers\AfipWsServiceProvider" --tag="config"

Configuration

Config file options:

Option Default Values
afipTempFolder '' (Automatically the package will choose /temp as folder in root directory) Any string. Ex.: storage_path('app/afip')
afipEnvironment '' (Automatically the package will choose DEV environment) Two options DEV or PROD, for homologation and production endpoints for AFIP Web Service.

Usage samples

Generate token and sign to get auth data and perform later actions.

Options array for method generateLTR (LoginTicketRequest):

  • cuit: Cuit of user that is going to use the web service
  • cn: commonName field of user that is going to use the web service
  • id: 32 bit digit that together with genTime will be used by the web service to identify the request
  • privateKey: Path where the private key generated by the AFIP site is stored
  • pemCert: Path where the CSR Certificate used to generate the private key is stored
  • genTime: Generation time of the authentication. Must be ISO8601 formatted. If not given the pacakge will set it to today
  • expTime: Expiration time of the authentication. Must be ISO8601 formatted. If not given the pacakge will set it to today + 24hs. The max tolerance for expiration is 24hs from the generation time.
use hazzo\LaravelAfipWrapper\AfipWs;
   
   $afipWs = new AfipWs();
   
   $options = [
       'cuit' => '2020200200',
       'cn' => 'test',
       'id' => 1,
       'privateKey' => './AfipPrivateKey.key',
       'pemCert' => './MyPEMKey.crt'
   ];
   
   $ltr = $afipWs->generateLTR($options);
   $afipWs->generateTRA($ltr);
   
   var_dump($afipWs->token);
   var_dump($afipWs->sign);
   var_dump($afipWs->cuit);
   

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-08-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固