hazzo / laravel-afip-wrapper
Afip Web Service wrapper for Laravel
v1.0.0-beta2
2017-08-17 08:07 UTC
Requires
- illuminate/support: ^5.1
This package is not auto-updated.
Last update: 2024-11-10 03:51:35 UTC
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:
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 servicecn
: commonName field of user that is going to use the web serviceid
: 32 bit digit that together withgenTime
will be used by the web service to identify the requestprivateKey
: Path where the private key generated by the AFIP site is storedpemCert
: Path where the CSR Certificate used to generate the private key is storedgenTime
: Generation time of the authentication. Must be ISO8601 formatted. If not given the pacakge will set it to todayexpTime
: 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);