PHP code example of amazscript / laravel-einvoicing

1. Go to this page and download the library: Download amazscript/laravel-einvoicing 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/ */

    

amazscript / laravel-einvoicing example snippets


namespace App\Listeners;

use AmazScript\Einvoicing\Events\InboundInvoiceReceived;

final class EnregistrerFactureFournisseur
{
    public function handle(InboundInvoiceReceived $event): void
    {
        $facture = $event->invoice;

        Achat::create([
            'fournisseur' => $facture->sender_name,
            'siren'       => $facture->sender_siren,
            'numero'      => $facture->invoice_number,
            'date'        => $facture->invoice_date,
            'montant_ttc' => $facture->amount_total,
            'montant_tva' => $facture->amount_tax,
            'devise'      => $facture->currency,
        ]);
    }
}

use AmazScript\Einvoicing\Facades\Einvoicing;

// Ce que le package détient
Einvoicing::for($tenant)->invoices()->local()->get();

// Ce que la plateforme n'a pas vu acquitté
Einvoicing::for($tenant)->invoices()->remoteNotSeen();

// Recherche, parcourue paresseusement
Einvoicing::for($tenant)->invoices()
    ->search(['invoice.direction' => 'INBOUND', 'invoice.state' => 'NOT_DELIVERED'])
    ->take(20);

// Une facture précise
Einvoicing::for($tenant)->invoice($id)->markAsSeen();
Einvoicing::for($tenant)->invoice($id)->readablePdf();
Einvoicing::for($tenant)->invoice($id)->attachments();
bash
composer einvoicing:install
php artisan migrate
php artisan einvoicing:secret
bash
php artisan queue:work --queue=einvoicing
bash
php artisan einvoicing:doctor