PHP code example of gabrielecorio / fiscozen-wrapper
1. Go to this page and download the library: Download gabrielecorio/fiscozen-wrapper 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/ */
gabrielecorio / fiscozen-wrapper example snippets
use GabrieleCorio\FiscozenWrapper\FiscozenClient;
use GabrieleCorio\FiscozenWrapper\Exceptions\AuthenticationException;
$client = new FiscozenClient(
email: '[email protected]',
password: 'your-password',
sessionDir: '/path/to/sessions', // optional; defaults to sys_get_temp_dir()/fiscozen_sessions
);
// --- Request 1: submit credentials ---
try {
$phoneNumber = $client->startLogin(); // returns the masked phone number
// Store $phoneNumber in your session and show the OTP input to the user
} catch (AuthenticationException $e) {
// handle error
}
// --- Request 2: submit OTP ---
try {
$client->submitOtp($otpFromUser);
} catch (AuthenticationException $e) {
// handle error
}
$client->login(function (string $phoneNumber): string {
echo "OTP sent to {$phoneNumber}: ";
return trim(fgets(STDIN));
});
$client->isAuthenticated(); // bool — makes a lightweight API call to verify the session
$client->logout(); // deletes the cookie file and invalidates the local session
$client->relogin($callback); // destroys the existing session and authenticates again
$invoices = $client->invoices()->list(
page: 1,
pageSize: 20,
selfInvoice: false,
);
foreach ($invoices->results as $invoice) {
// Read the fields needed by your application.
}
$formatInfo = $client->invoices()->getFormatInfo(
new DateTimeImmutable('2026-01-15'),
);