PHPackages                             devomar-2/invoice-generator - 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. devomar-2/invoice-generator

ActiveLibrary

devomar-2/invoice-generator
===========================

Laravel package for generating unique invoice numbers

11PHPCI failing

Since May 10Pushed 1y ago1 watchersCompare

[ Source](https://github.com/devOMAR-2/invoice-generator)[ Packagist](https://packagist.org/packages/devomar-2/invoice-generator)[ RSS](/packages/devomar-2-invoice-generator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Invoice Generator
=========================

[](#laravel-invoice-generator)

A Laravel package for generating unique invoice numbers with customizable prefixes and auto-incrementing sequences.

Features
--------

[](#features)

- Generate unique invoice numbers (e.g., `INV-2505-0001`, `ORD-2505-0002`)
- Customizable prefixes for different document types
- Auto-incrementing sequence numbers
- Monthly/yearly reset options
- Database-backed sequence tracking
- Laravel 11+ support
- Comprehensive test coverage
- Artisan command included

Requirements
------------

[](#requirements)

- PHP ^8.2
- Laravel ^11.0

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

[](#installation)

1. Install the package via Composer:

```
composer require your-vendor/invoice-generator
```

2. Publish the configuration file:

```
php artisan vendor:publish --tag=invoice-generator-config
```

3. Publish and run the migration:

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

Configuration
-------------

[](#configuration)

The configuration file `config/invoice-generator.php` allows you to customize:

```
return [
    'default_prefix' => 'INV',

    'prefixes' => [
        'invoice' => 'INV',
        'order' => 'ORD',
        'quote' => 'QUO',
    ],

    'format' => [
        'separator' => '-',
        'year_format' => 'y',    // 'Y' for 2025, 'y' for 25
        'month_format' => 'm',   // 'm' for 05, 'n' for 5
        'number_padding' => 4,   // Number of digits
    ],

    'reset_period' => 'monthly', // 'yearly', 'monthly', 'never'
];
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

```
use Devomar2\InvoiceGenerator\Contracts\InvoiceGeneratorInterface;

// Generate with default prefix
$generator = app(InvoiceGeneratorInterface::class);
$invoice = $generator->generate(); // INV-2505-0001

// Generate with custom prefix
$order = $generator->generate('ORD'); // ORD-2505-0001

// Generate for specific date
$date = new DateTime('2025-12-15');
$invoice = $generator->generate('INV', $date); // INV-2512-0001
```

### Facade Usage (Optional)

[](#facade-usage-optional)

You can create a facade for easier access:

```
// Create app/Facades/InvoiceGenerator.php
namespace App\Facades;

use Illuminate\Support\Facades\Facade;

class InvoiceGenerator extends Facade
{
    protected static function getFacadeAccessor()
    {
        return 'invoice-generator';
    }
}

// Usage
$invoice = \App\Facades\InvoiceGenerator::generate('INV');
```

### Artisan Command

[](#artisan-command)

Generate invoices from the command line:

```
# Generate one invoice
php artisan invoice:generate

# Generate with custom prefix
php artisan invoice:generate --prefix=ORD

# Generate multiple invoices
php artisan invoice:generate --count=5

# Generate for specific date
php artisan invoice:generate --date=2025-12-31
```

### Events

[](#events)

The package dispatches an event when an invoice is generated:

```
use Devomar2\InvoiceGenerator\Events\InvoiceGenerated;
use Illuminate\Support\Facades\Event;

Event::listen(InvoiceGenerated::class, function ($event) {
    // $event->invoiceNumber
    // $event->prefix
    // $event->date
});
```

Testing
-------

[](#testing)

Run the package tests:

```
composer test
```

Run with coverage:

```
composer test-coverage
```

Development
-----------

[](#development)

### Setting Up for Development

[](#setting-up-for-development)

1. Clone the repository
2. Install dependencies: `composer install`
3. Copy `.env.example` to `.env`
4. Run tests: `composer test`

### Code Style

[](#code-style)

The package follows PSR-12 coding standards. Run PHP-CS-Fixer:

```
composer fix-style
```

License
-------

[](#license)

This package is open-sourced software licensed under the MIT license.

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

[](#contributing)

Please see CONTRIBUTING.md for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/bc40bffeb1541c9dc6710261770736c029d507deb3fabd927652ae158d539b06?d=identicon)[devOMAR](/maintainers/devOMAR)

---

Top Contributors

[![devOMAR-2](https://avatars.githubusercontent.com/u/93110311?v=4)](https://github.com/devOMAR-2 "devOMAR-2 (1 commits)")

---

Tags

generatorinvoicelaravelunique

### Embed Badge

![Health badge](/badges/devomar-2-invoice-generator/health.svg)

```
[![Health](https://phpackages.com/badges/devomar-2-invoice-generator/health.svg)](https://phpackages.com/packages/devomar-2-invoice-generator)
```

PHPackages © 2026

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