1. Go to this page and download the library: Download facturino/facturino-php 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/ */
// Iterate over all invoices automatically
foreach (\Facturino\Invoice::all(['limit' => 10]) as $invoice) {
echo $invoice['id'] . ' ' . $invoice['status'] . "\n";
}
// Or access the first page directly
$collection = \Facturino\Invoice::all(['limit' => 25]);
$firstPage = $collection->getData();
$hasMore = $collection->hasMore();
// Clone a quote as a new draft (mirrors Invoice::clone)
$draft = \Facturino\Quote::clone('quo_xxx');
// Convert an accepted quote to a draft invoice
$invoice = \Facturino\Quote::convert('quo_xxx');
// Invoices issued from a given quote
$invoices = \Facturino\Invoice::all(['convertedFrom' => 'quo_xxx']);
// Inline related resources on a single invoice. `expand` is
// comma-separated and accepts `customer`, `items.product` and
// `credit_notes`. With `credit_notes` the response gains
// `expanded.credit_notes` (array) and `expanded.net_balance` (string).
$invoice = \Facturino\Invoice::retrieve('inv_xxx', [
'expand' => 'customer,credit_notes',
]);
// Product filters: q (name prefix), category, active
$products = \Facturino\Product::all([
'q' => 'consult',
'category' => 'services',
'active' => true,
]);
$result = \Facturino\Invoice::getPdf('inv_xxx');
if (isset($result['url'])) {
// PDF already exists — download from signed URL
$pdfUrl = $result['url'];
} else {
// Async generation — poll the job
$jobId = $result['id'];
do {
sleep(2);
$job = \Facturino\Job::retrieve($jobId);
} while ($job['status'] === 'pending');
if ($job['status'] === 'completed') {
$pdfUrl = $job['url'];
}
}
\Facturino\Facturino::setApiKey('fac_test_xxx');
// Reset test data and load fixtures
\Facturino\Sandbox::resetData();
// Simulate PA status changes
\Facturino\Sandbox::simulateStatus('inv_xxx', 'deposited');
\Facturino\Sandbox::simulateStatus('inv_xxx', 'approved');
// Override API base URL (for testing or proxying)
\Facturino\Facturino::setApiBase('https://localhost:5001/api');
bash
composer
bash
git clone https://github.com/facturino/facturino-php.git
cd facturino-php
composer install
vendor/bin/phpunit
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.