Skip to content

Commit

Permalink
Updates readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
mc0de committed Nov 16, 2023
1 parent 0b50e0b commit 192bf16
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 123 deletions.
25 changes: 25 additions & 0 deletions PREVIOUS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
### Laravel version <= 8

```bash
$ composer require laraveldaily/laravel-invoices:^2.0
```

### Laravel version <= 7

```bash
$ composer require laraveldaily/laravel-invoices:^1.3
```

### For Laravel version < 5.5

If you don't use auto-discovery, add the ServiceProvider to the providers array in `config/app.php`

```php
LaravelDaily\Invoices\InvoiceServiceProvider::class,
```

If you want to use the facade to generate invoices, add this to your facades in `config/app.php`

```php
'Invoice' => LaravelDaily\Invoices\Facades\Invoice::class
```
223 changes: 100 additions & 123 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,38 +36,29 @@ Please see the [changelog](CHANGELOG.md) for more information on what has change

Via Composer

### Laravel version <= 10

```bash
$ composer require laraveldaily/laravel-invoices:^3.0
```

### Laravel version <= 8

```bash
$ composer require laraveldaily/laravel-invoices:^2.0
```

### Laravel version <= 7

```bash
$ composer require laraveldaily/laravel-invoices:^1.3
```
> [Older versions](PREVIOUS.md)
After installing Laravel Invoices, publish its assets, views, translations and config using the `invoices:install` Artisan command:

```bash
$ php artisan invoices:install
```

### Updates

Since it is evolving fast you might want to have latest template after update using Artisan command:

```bash
$ php artisan invoices:update
```
> It will give a warning if you really want to override default resources
Or alternatively it can be done separately.

```bash
$ php artisan vendor:publish --tag=invoices.views --force
```
Expand All @@ -76,20 +67,6 @@ $ php artisan vendor:publish --tag=invoices.views --force
$ php artisan vendor:publish --tag=invoices.translations --force
```

### For Laravel version < 5.5

If you don't use auto-discovery, add the ServiceProvider to the providers array in `config/app.php`

```php
LaravelDaily\Invoices\InvoiceServiceProvider::class,
```

If you want to use the facade to generate invoices, add this to your facades in `config/app.php`

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

## Basic Usage

**RandomController.php**
Expand All @@ -98,25 +75,25 @@ 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]',
],
]);
$customer = new Buyer([
'name' => 'John Doe',
'custom_fields' => [
'email' => '[email protected]',
],
]);

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

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

return $invoice->stream();
return $invoice->stream();
```

See result [Invoice_AA_00001.pdf](examples/invoice_AA_00001.pdf).
Expand All @@ -128,89 +105,88 @@ use LaravelDaily\Invoices\Invoice;
use LaravelDaily\Invoices\Classes\Party;
use LaravelDaily\Invoices\Classes\InvoiceItem;

<...>
// ...

$client = new Party([
'name' => 'Roosevelt Lloyd',
'phone' => '(520) 318-9486',
'custom_fields' => [
'note' => 'IDDQD',
'business id' => '365#GG',
],
]);
$client = new Party([
'name' => 'Roosevelt Lloyd',
'phone' => '(520) 318-9486',
'custom_fields' => [
'note' => 'IDDQD',
'business id' => '365#GG',
],
]);

$customer = new Party([
'name' => 'Ashley Medina',
'address' => 'The Green Street 12',
'code' => '#22663214',
'custom_fields' => [
'order number' => '> 654321 <',
],
]);

$items = [
(new InvoiceItem())
->title('Service 1')
->description('Your product or service description')
->pricePerUnit(47.79)
->quantity(2)
->discount(10),
(new InvoiceItem())->title('Service 2')->pricePerUnit(71.96)->quantity(2),
(new InvoiceItem())->title('Service 3')->pricePerUnit(4.56),
(new InvoiceItem())->title('Service 4')->pricePerUnit(87.51)->quantity(7)->discount(4)->units('kg'),
(new InvoiceItem())->title('Service 5')->pricePerUnit(71.09)->quantity(7)->discountByPercent(9),
(new InvoiceItem())->title('Service 6')->pricePerUnit(76.32)->quantity(9),
(new InvoiceItem())->title('Service 7')->pricePerUnit(58.18)->quantity(3)->discount(3),
(new InvoiceItem())->title('Service 8')->pricePerUnit(42.99)->quantity(4)->discountByPercent(3),
(new InvoiceItem())->title('Service 9')->pricePerUnit(33.24)->quantity(6)->units('m2'),
(new InvoiceItem())->title('Service 11')->pricePerUnit(97.45)->quantity(2),
(new InvoiceItem())->title('Service 12')->pricePerUnit(92.82),
(new InvoiceItem())->title('Service 13')->pricePerUnit(12.98),
(new InvoiceItem())->title('Service 14')->pricePerUnit(160)->units('hours'),
(new InvoiceItem())->title('Service 15')->pricePerUnit(62.21)->discountByPercent(5),
(new InvoiceItem())->title('Service 16')->pricePerUnit(2.80),
(new InvoiceItem())->title('Service 17')->pricePerUnit(56.21),
(new InvoiceItem())->title('Service 18')->pricePerUnit(66.81)->discountByPercent(8),
(new InvoiceItem())->title('Service 19')->pricePerUnit(76.37),
(new InvoiceItem())->title('Service 20')->pricePerUnit(55.80),
];

$notes = [
'your multiline',
'additional notes',
'in regards of delivery or something else',
];
$notes = implode("<br>", $notes);

$invoice = Invoice::make('receipt')
->series('BIG')
// ability to include translated invoice status
// in case it was paid
->status(__('invoices::invoice.paid'))
->sequence(667)
->serialNumberFormat('{SEQUENCE}/{SERIES}')
->seller($client)
->buyer($customer)
->date(now()->subWeeks(3))
->dateFormat('m/d/Y')
->payUntilDays(14)
->currencySymbol('$')
->currencyCode('USD')
->currencyFormat('{SYMBOL}{VALUE}')
->currencyThousandsSeparator('.')
->currencyDecimalPoint(',')
->filename($client->name . ' ' . $customer->name)
->addItems($items)
->notes($notes)
->logo(public_path('vendor/invoices/sample-logo.png'))
// You can additionally save generated invoice to configured disk
->save('public');

$link = $invoice->url();
// Then send email to party with link

// And return invoice itself to browser or have a different view
return $invoice->stream();
$customer = new Party([
'name' => 'Ashley Medina',
'address' => 'The Green Street 12',
'code' => '#22663214',
'custom_fields' => [
'order number' => '> 654321 <',
],
]);

$items = [
InvoiceItem::make('Service 1')
->description('Your product or service description')
->pricePerUnit(47.79)
->quantity(2)
->discount(10),
InvoiceItem::make('Service 2')->pricePerUnit(71.96)->quantity(2),
InvoiceItem::make('Service 3')->pricePerUnit(4.56),
InvoiceItem::make('Service 4')->pricePerUnit(87.51)->quantity(7)->discount(4)->units('kg'),
InvoiceItem::make('Service 5')->pricePerUnit(71.09)->quantity(7)->discountByPercent(9),
InvoiceItem::make('Service 6')->pricePerUnit(76.32)->quantity(9),
InvoiceItem::make('Service 7')->pricePerUnit(58.18)->quantity(3)->discount(3),
InvoiceItem::make('Service 8')->pricePerUnit(42.99)->quantity(4)->discountByPercent(3),
InvoiceItem::make('Service 9')->pricePerUnit(33.24)->quantity(6)->units('m2'),
InvoiceItem::make('Service 11')->pricePerUnit(97.45)->quantity(2),
InvoiceItem::make('Service 12')->pricePerUnit(92.82),
InvoiceItem::make('Service 13')->pricePerUnit(12.98),
InvoiceItem::make('Service 14')->pricePerUnit(160)->units('hours'),
InvoiceItem::make('Service 15')->pricePerUnit(62.21)->discountByPercent(5),
InvoiceItem::make('Service 16')->pricePerUnit(2.80),
InvoiceItem::make('Service 17')->pricePerUnit(56.21),
InvoiceItem::make('Service 18')->pricePerUnit(66.81)->discountByPercent(8),
InvoiceItem::make('Service 19')->pricePerUnit(76.37),
InvoiceItem::make('Service 20')->pricePerUnit(55.80),
];

$notes = [
'your multiline',
'additional notes',
'in regards of delivery or something else',
];
$notes = implode("<br>", $notes);

$invoice = Invoice::make('receipt')
->series('BIG')
// ability to include translated invoice status
// in case it was paid
->status(__('invoices::invoice.paid'))
->sequence(667)
->serialNumberFormat('{SEQUENCE}/{SERIES}')
->seller($client)
->buyer($customer)
->date(now()->subWeeks(3))
->dateFormat('m/d/Y')
->payUntilDays(14)
->currencySymbol('$')
->currencyCode('USD')
->currencyFormat('{SYMBOL}{VALUE}')
->currencyThousandsSeparator('.')
->currencyDecimalPoint(',')
->filename($client->name . ' ' . $customer->name)
->addItems($items)
->notes($notes)
->logo(public_path('vendor/invoices/sample-logo.png'))
// You can additionally save generated invoice to configured disk
->save('public');

$link = $invoice->url();
// Then send email to party with link

// And return invoice itself to browser or have a different view
return $invoice->stream();
```

See result [Roosevelt Lloyd Ashley Medina.pdf](examples/Roosevelt%20Lloyd%20Ashley%20Medina.pdf).
Expand Down Expand Up @@ -406,6 +382,7 @@ Almost every configuration value can be overrided dynamically by methods.
- toHtml() - render html view instead of pdf

## InvoiceItem
- make(string) - [static function] same as `(new InvoiceItem())->title(string)`
- title(string) - product or service name
- description(string) - additional information for service entry
- units(string) - measurement units of item (adds units columns if set)
Expand Down

0 comments on commit 192bf16

Please sign in to comment.