PHP code example of elitexp / laravel-invoices

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

    

elitexp / laravel-invoices example snippets


LaravelDaily\Invoices\InvoiceServiceProvider::class,

'Invoice' => LaravelDaily\Invoices\Facades\Invoice::class

use LaravelDaily\Invoices\Invoice;
use LaravelDaily\Invoices\Classes\Buyer;
use LaravelDaily\Invoices\Classes\InvoiceItem;

<...>

        $customer = new Buyer([
            'name'          => 'John Doe',
            'custom_fields' => [
                'email' => '[email protected]',
            ],
        ]);

        $item = (new InvoiceItem())->title('Service 1')->pricePerUnit(2);

        $invoice = Invoice::make()
            ->buyer($customer)
            ->discountByPercent(10)
            ->taxRate(15)
            ->shipping(1.99)
            ->addItem($item);

        return $invoice->stream();

use Invoice;

$customer = Invoice::makeParty([
    'name' => 'John Doe',
]);

$item = Invoice::makeItem('Your service or product title')->pricePerUnit(9.99);

return Invoice::make()->buyer($customer)->addItem($item)->stream();
bash
$ php artisan invoices:install
bash
$ php artisan invoices:update