Download the PHP package andreaballarin/acube-italy-receipts without Composer

On this page you can find all versions of the php package andreaballarin/acube-italy-receipts. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package acube-italy-receipts

Acube eReceipts PHP SDK

SDK PHP 8.3+ per l'integrazione delle API Acube per gli Scontrini Elettronici (Documento Commerciale italiano).

Installazione

Requisiti

Quick Start

1. Login e ottieni il token JWT

2. Setup del Client

3. Registra il Client per l'utilizzo statico

4. Crea uno scontrino

5. Recupera e annulla

Onboarding: Merchant → PEM → Cash Register

Prima di poter emettere scontrini serve completare l'onboarding: creare un merchant, creare e attivare un PEM, poi creare il cash register che rilascia il certificato mTLS. Vedi examples/complete-supplier-onboarding.php per il flusso completo.

Importante: Merchant/Pem::create()/Pem::get()/Pem::activate()/CashRegister::create() usano la porta standard (nessun mTLS) — solo gli endpoint /mf1/receipts* (Receipt, ReceiptDetails) richiedono mTLS e vengono chiamati automaticamente sulla porta 444 quando il Client ha mtlsCertPath configurato. Usa quindi Client separati: uno senza mTLS per l'onboarding, uno con mTLS per gli scontrini. Poiché ApiResource::setClient() condivide un unico slot statico tra tutte le resource, richiama setClient() ogni volta che cambi Client.

1. Crea un merchant

2. Crea e attiva un PEM

3. Crea il cash register (rilascia il certificato mTLS)

4. Recupera il dettaglio fiscale completo di uno scontrino

Nota: richiede lo stesso Client con mTLS

Login & Autenticazione

L'SDK include AuthenticationService per gestire il login presso Acube:

Note:

Caching del JWT (TTL-aware)

Per i flussi sincroni in cassa, ogni login fresco aggiunge una round-trip di rete. Se emetti più scontrini rapidamente, il caching del JWT riusa il token finché è valido, riloggando solo quando sta per scadere:

Dettagli:

Features

Punto 1: Dependency Injection

Due modalità di utilizzo:

Punto 2: DecimalAmount Validation

Tutti gli importi/quantità sono string per preservare la precisione. DecimalAmount::assertValid() fallisce velocemente:

Punto 3: UUID Validation

UuidValidator valida localmente prima di fare richieste HTTP:

Punto 4: PSR-3 Logging

Inietta un logger PSR-3 per registrare:

Punto 5: Dump delle chiamate HTTP

Per diagnosticare a posteriori un'emissione fallita (o qualunque altra chiamata), il Client può salvare un file JSON per ogni chiamata HTTP (richiesta + risposta complete). callDumpStorage accetta sia una cartella locale sia uno storage esterno (es. un disco Laravel):

Dettagli:

Gestione Errori

Idempotenza (Best-Effort, Client-Side)

Nota: Questa guardia protegge solo dentro lo stesso processo. Acube non offre idempotency key server-side, quindi un timeout di rete potrebbe causare duplicati.

Pattern consigliato per retry sicuri

Dopo un fallimento incerto (es. timeout di rete), verifica che lo scontrino non sia già stato emesso prima di riprare:

Test

Struttura

Licenza

MIT

Autore

Andrea Ballarin [email protected]


All versions of acube-italy-receipts with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
guzzlehttp/guzzle Version ^7.8
guzzlehttp/psr7 Version ^2.6
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.1 || ^2.0
psr/log Version ^3.0
psr/simple-cache Version ^2.0 || ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package andreaballarin/acube-italy-receipts contains the following files

Loading the files please wait ...