1. Go to this page and download the library: Download einvoicing/laravel 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/ */
einvoicing / laravel example snippets
use Einvoicing\Laravel\Facades\Einvoicing;
$report = Einvoicing::validate($xml);
if (! $report->valid) {
foreach ($report->errors() as $finding) {
logger()->warning("{$finding->ruleId}: {$finding->message}", [
'fix' => $finding->fix,
'terms' => $finding->businessTerms,
]);
}
}
use Einvoicing\Laravel\Rules\PeppolDocument;
$request->validate([
'invoice' => ['
if (! Einvoicing::canReceive($customer->peppol_id)) {
// Tell them, rather than failing a send later.
}
$participant = Einvoicing::participant($customer->peppol_id);
$participant->registered;
$participant->capabilities;
use Einvoicing\Laravel\Facades\Einvoicing;
it('will not send an invoice the network would reject', function () {
$fake = Einvoicing::fake()->shouldBeInvalid(['PEPPOL-EN16931-R003']);
$this->post('/invoices/1/send')->assertSessionHasErrors();
$fake->assertValidated();
});
Einvoicing::fake()->shouldBeInvalid(['BR-CO-10']); // by rule id
Einvoicing::fake()->shouldBeInvalid([[...]]); // full findings
Einvoicing::fake()->shouldFind('9932:GB1', registered: false); // off the network
Einvoicing::fake()->shouldFind('9932:GB1', documentTypes: ['Order-2::Order']);
Einvoicing::fake()->shouldFindNobody();