PHPackages                             visanduma/laravel-invoice - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. visanduma/laravel-invoice

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

visanduma/laravel-invoice
=========================

Simple package to manage invoices

v0.2.0(2y ago)110[1 PRs](https://github.com/Visanduma/laravel-invoice/pulls)MITPHPPHP ^7.4|^8.0CI failing

Since Jan 7Pushed 1y ago2 watchersCompare

[ Source](https://github.com/Visanduma/laravel-invoice)[ Packagist](https://packagist.org/packages/visanduma/laravel-invoice)[ Docs](https://github.com/visanduma/laravel-invoice)[ GitHub Sponsors](https://github.com/Visanduma)[ RSS](/packages/visanduma-laravel-invoice/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (6)Versions (5)Used By (0)

Laravel Invoice
===============

[](#laravel-invoice)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b87f47e78f9b12714f649fde267a357d383fd6c446765bdab40026763adae9af/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f766973616e64756d612f6c61726176656c2d696e766f6963652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/visanduma/laravel-invoice)[![GitHub Tests Action Status](https://camo.githubusercontent.com/286f83d57b71c1d6fb9220c3e0dfaadda1e63feac498aa4d1fce4877e41a20bf/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f766973616e64756d612f6c61726176656c2d696e766f6963652f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/visanduma/laravel-invoice/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/1174e9099abb35fdbfb18ff4aa5426413abfda8b5d3d138787577310e947db0f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f766973616e64756d612f6c61726176656c2d696e766f6963652f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/visanduma/laravel-invoice/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/a056082f1d1a97c2f5cc40335830d85d1780920dd035fb5950069bdf3b39f460/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f766973616e64756d612f6c61726176656c2d696e766f6963652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/visanduma/laravel-invoice)

Yet another simple &amp; powerful invoicing package for Laravel

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require visanduma/laravel-invoice
```

You can publish and run the migrations with:

```
php artisan vendor:publish --tag="invoice-migrations"
php artisan migrate
```

Usage
-----

[](#usage)

### Model configuration

[](#model-configuration)

Make any model invoice-able using `InvoiceAble` trait

```
use Visanduma\LaravelInvoice\Helpers\Traits\InvoiceAble;

class Customer extends Model
{
    use InvoiceAble;

	...
}
```

now your model is ready to create invoices

### Create invoice

[](#create-invoice)

```
$customer->invoices()->create([
	'invoice_date' => now(),
	'tag' => 'default'  // optional. just for identification
])

// or

$invoice = Invoice::make();
$customer->attachInvoice($invoice)
```

### Add items to invoice

[](#add-items-to-invoice)

```
// adding single item
$invoice->items()->create([
	'name' => 'Product one',
	'price' => 150,
	'qty' => 1,
	// optional fields
	'description' => 'tiny description',
	'unit' => 'Nos',
    'tag' => '',
    'discount' => 0,
    'discount_type' => InvoiceItem::DISCOUNT_FLAT,
]);

// adding multiple items

$invoice->items()->createMany([
	['name' => 'Product 2', 'price' => 100, 'qty' => 2],
    ['name' => 'Product 3', 'price' => 80, 'qty' => 1],
]);
```

### Adding additional information to invoice

[](#adding-additional-information-to-invoice)

```
// adding single value
$invoice->setExtraValue('something','and its value')

// adding multiple values at once
$invoice->setExtraValues([
	'something' => '',
	'another thing' => 'another value'
])

// retrieve back extra values
$invoice->getExtraValue('something') // returns 'and its value'
```

### Add payment for invoice

[](#add-payment-for-invoice)

```
$invoice->addPayment(100)
$invoice->addPayment(100,'advance payment') // pay with note

$invoice->addPayment(-10) // use minus values to make deduction

// get total of paid
$invoice->paidAmount() // 190 (100 + 100 - 10)

// get payment due amount
$invoice->dueAmount()
```

### Add discount/tax to invoice

[](#add-discounttax-to-invoice)

```
// set flat discount amount
$invoice->setDiscount(50)

// set percentage of discount
$invoice->setDiscount('5%')

// add tax
$invoice->addTax('VAT', 12) // 12 equals to 12%
```

### Add discount to invoice item

[](#add-discount-to-invoice-item)

```
// set flat discount amount
$invoiceItem->setDiscount(50)

// set percentage of discount
$invoiceItem->setDiscount('5%')
```

### Calculation of invoice

[](#calculation-of-invoice)

```
$invoice->items()->createMany([
	['name' => 'Product 2', 'price' => 100, 'qty' => 2],
    ['name' => 'Product 3', 'price' => 80, 'qty' => 1],
]);

// get total amount of invoice items

$invoice->getItemsTotal() // 280
```

### Invoice item helpers

[](#invoice-item-helpers)

```
$item = InvoiceItem::create([
	'name' => 'Product one',
	'price' => 100,
	'qty' => 1,
])

// Set discount per item
$item->setDiscount(10) // total is 90
$item->setDiscount('50%') // total is 50

// get total amount
$item->total

//get total without discount
$item->totalWithoutDiscount()
```

### Invoice helpers

[](#invoice-helpers)

```
// find invoice by invoice number
$customer->findInvoiceByNumber('INV000001')

// update invoice status
$invoice->setStatus(Invoice::STATUS_COMPLETED)
$invoice->setStatus(Invoice::STATUS_DRAFT)
$invoice->setStatus(Invoice::STATUS_SENT)

// get status
$invoice->status

// update payment status
$invoice->setPaymentStatus(Invoice::STATUS_UNPAID)
$invoice->setPaymentStatus(Invoice::STATUS_PAID)

// get paid status
$invoice->paid_status

// get invoice total without taxes & invoice discount
$invoice->getItemsTotal()

// invoice item count
$invoice->getItemCount()

// invoice due
$invoice->dueAmount()

// invoiced tax
$invoice->totalTaxAmount()

// invoice total
$invoice->total

// set invoice currency symbol
$invoice->setCurrency('Rs.') // default is $
```

### Generate invoice data array

[](#generate-invoice-data-array)

```
$invoice->toArray()

// output

[

"from" => [
    "name" => "Seller name"
    "address" => "Seller Street one, City, PO CODE"
    "contact" => ""
    "extra" => ""
  ]
  "to" => [
    "name" => "Customer name"
    "address" => "Street one, City, PO CODE"
    "contact" => ""
    "extra" => ""
  ]
  "items" => [
    0 => [
      "id" => 1
      "invoice_id" => "1"
      "name" => "product 1"
      "description" => null
      "discount" => 0.0
      "discount_value" => 0.0
      "discount_type" => null
      "price" => 100.0
      "qty" => 2
      "unit" => null
      "total" => 200.0
      "item_id" => null
      "tag" => null
      "created_at" => "2022-09-02 07:43:10"
      "updated_at" => "2022-09-02 07:43:10"
    ]
    1 => [
      "id" => 2
      "invoice_id" => "1"
      "name" => "product 2"
      "description" => null
      "discount" => 0.0
      "discount_value" => 0.0
      "discount_type" => null
      "price" => 150.0
      "qty" => 1
      "unit" => null
      "total" => 150.0
      "item_id" => null
      "tag" => null
      "created_at" => "2022-09-02 07:43:10"
      "updated_at" => "2022-09-02 07:43:10"
    ]
  ]
  "payments" => [
    0 =>  [
      "id" => 1
      "invoice_id" => "1"
      "method" => "CASH"
      "amount" => "50"
      "note" => "I paid"
      "payment_date" => "2022-09-02 07:43:10"
      "created_at" => "2022-09-02 07:43:10"
      "updated_at" => "2022-09-02 07:43:10"
    ]
  ]
  "taxes" =>  [
    0 =>  [
      "name" => "VAT"
      "value" => 12
      "amount" => 42
    ]
    1 => [
      "name" => "NBT"
      "value" => 5
      "amount" => 17.5
    ]
  ]
  "summary" => [
    "items_count" => 2
    "gross_total" => "Rs.350.00"
    "total" => "Rs.409.50"
    "discount" => "Rs.0.00"
    "paid_amount" => "Rs.50.00"
    "due_amount" => "Rs.359.50"
    "tax_total" => "Rs.59.50"
    "status" => "DRAFT"
    "date" => "2022-09-02 07:43:10"
    "currency" => "Rs."
  ]
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Visanduma](https://github.com/Visanduma)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 82.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~852 days

Total

2

Last Release

733d ago

PHP version history (2 changes)v0.1.0PHP ^8.0

v0.2.0PHP ^7.4|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/30f6d3c78c26dd226777b19b659363509fe92a95a682fbfcba13eda64060b591?d=identicon)[dumithrathnayaka](/maintainers/dumithrathnayaka)

---

Top Contributors

[![lahirulhr](https://avatars.githubusercontent.com/u/13136764?v=4)](https://github.com/lahirulhr "lahirulhr (47 commits)")[![dumithsalinda](https://avatars.githubusercontent.com/u/1443237?v=4)](https://github.com/dumithsalinda "dumithsalinda (10 commits)")

---

Tags

laravelLaravel InvoiceVisanduma

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/visanduma-laravel-invoice/health.svg)

```
[![Health](https://phpackages.com/badges/visanduma-laravel-invoice/health.svg)](https://phpackages.com/packages/visanduma-laravel-invoice)
```

###  Alternatives

[spatie/laravel-data

Create unified resources and data transfer objects

1.7k28.9M627](/packages/spatie-laravel-data)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[hirethunk/verbs

An event sourcing package that feels nice.

513162.9k6](/packages/hirethunk-verbs)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[ralphjsmit/livewire-urls

Get the previous and current url in Livewire.

82270.3k4](/packages/ralphjsmit-livewire-urls)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
