PHP code example of nexdev / invoice-creator

1. Go to this page and download the library: Download nexdev/invoice-creator 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/ */

    

nexdev / invoice-creator example snippets


'disks' => [
    // ... other disks ...

    'incoming_invoices' => [
        'driver' => 'local',
        'root' => storage_path('app/incoming_invoices'),
        'url' => env('APP_URL').'/storage/incoming_invoices',
        'visibility' => 'public',
        'throw' => false,
        'report' => false,
    ],

    'outgoing_invoices' => [
        'driver' => 'local',
        'root' => storage_path('app/outgoing_invoices'),
        'url' => env('APP_URL').'/storage/outgoing_invoices',
        'visibility' => 'public',
        'throw' => false,
        'report' => false,
    ],
],

use NexDev\InvoiceCreator\Models\Seller;
use NexDev\InvoiceCreator\Models\Buyer;
use NexDev\InvoiceCreator\Models\OutgoingInvoice;

// Create the seller information
$seller = Seller::make()
    ->setName('Acme Corporation')
    ->setEmail('[email protected]')
    ->setPhone('+1 (555) 123-4567')
    ->setAddress('123 Business Street')
    ->setZip('10001')
    ->setCity('New York')
    ->setCountry('United States')
    ->setKvk('12345678')
    ->setVat('US12345678901');

// Create the buyer information
$buyer = Buyer::make()
    ->setName('Tech Solutions Ltd')
    ->setAddress('456 Innovation Drive')
    ->setZip('EC2A 4PB')
    ->setCity('London')
    ->setCountry('United Kingdom');

// Create and process the invoice
return OutgoingInvoice::make()
    ->setLogo('images/logo.png')
    ->setSeller($seller)
    ->setBuyer($buyer)
    ->setId('INV-2025-001')
    ->saveToDatabase()
    ->saveToStorage()
    ->stream();
bash
php artisan invoice:install