1. Go to this page and download the library: Download xingen/xingen-sdk 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/ */
xingen / xingen-sdk example snippets
use Xingen\Sdk\XingenClient;
$client = new XingenClient(apiKey: getenv('XINGEN_API_KEY'));
use Xingen\Sdk\Models\InvoiceStatus;
use Xingen\Sdk\Models\ValidationProfile;
$result = $client->invoices->validateFileAndWait('invoice.xml', ValidationProfile::XRECHNUNG);
if ($result->status === InvoiceStatus::VALIDATED && $result->validationResult->valid) {
echo "Valid!\n";
} else {
foreach ($result->validationResult->errors as $error) {
echo "{$error->severity->value}: {$error->message} ({$error->field})\n";
}
}
use Xingen\Sdk\Invoices\PollOptions;
$options = new PollOptions(initialInterval: 0.3, maxInterval: 3.0, timeout: 30.0);
$result = $client->invoices->validateFileAndWait('invoice.xml', ValidationProfile::XRECHNUNG, $options);
use Xingen\Sdk\Models\ExtractionModelTier;
$result = $client->invoices->extractInvoiceAndWait(
'scanned-invoice.pdf',
ValidationProfile::EN16931,
ExtractionModelTier::FAST, // or ACCURATE -- higher accuracy, Pro subscription
$page = $client->invoices->list(0, 20, 'createdAt,desc');
// or, to walk every invoice without managing page indices yourself:
foreach ($client->invoices->listAll(50) as $record) {
echo "{$record->id} -> {$record->status->value}\n";
}
$one = $client->invoices->get('inv_01HXYZ');
$pdf = $client->invoices->downloadPdf($id); // ZUGFeRD PDF with embedded XML
$idocXml = $client->invoices->downloadIdocXml($id); // SAP IDoc XML
use Xingen\Sdk\ApiKeys\CreateApiKeyRequest;
$created = $client->apiKeys->create(new CreateApiKeyRequest(name: 'Production CI', sandbox: false));
echo "Store this now, it's shown only once: {$created->rawKey}\n";
$keys = $client->apiKeys->list();
$client->apiKeys->revoke($created->id);
use Xingen\Sdk\Error\QuotaExceededException;
use Xingen\Sdk\Error\ValidationRequestException;
use Xingen\Sdk\Error\XingenException;
try {
$client->invoices->submit($submission);
} catch (ValidationRequestException $e) {
foreach ($e->fieldErrors as $field => $message) {
echo "{$field}: {$message}\n";
}
} catch (QuotaExceededException $e) {
echo "Quota exceeded — upgrade or wait for the next billing period\n";
} catch (XingenException $e) {
echo "Request failed: {$e->getMessage()}\n";
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.