Download the PHP package salehye/invoicing without Composer

On this page you can find all versions of the php package salehye/invoicing. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package invoicing

salehye/invoicing

PHP 8.2+ Laravel 11|12|13 [Tests]()

A standalone Laravel invoicing package with multi-gateway payment support โ€” create invoices, manage line items with taxes/discounts, and process payments through Stripe, bank transfer (with manual admin verification), local testing, or any custom gateway.

Zero dependency on subscription billing packages โ€” use independently or alongside any subscription system.


โœจ Features


๐Ÿ“ฆ Installation

Publish Config & Migrations

Environment Variables


โš™๏ธ Configuration

Full config file at config/invoicing.php:

Key Default Description
currency USD Default currency per invoice
invoice_number_format {prefix}-{year}-{sequence} Invoice number template
invoice_number_prefix INV Invoice number prefix
invoice_number_sequence_length 4 Sequence digit count
default_gateway local Default payment gateway
gateways.* โ€” Per-gateway config (see Gateways section)
default_tax_rate 0 Default tax % (0 = no tax)
overdue_threshold_days 0 Days past due_at before overdue
table_names.invoices invoices Invoices table name
table_names.invoice_lines invoice_lines Invoice lines table name
table_names.payments payments Payments table name
user_model App\Models\User User model for relationships

๐Ÿš€ Quick Start

Step 1: Make a Model Billable

This adds: invoices(), unpaidInvoices(), paidInvoices(), overdueInvoices(), totalInvoiceBalance()

Step 2: Create an Invoice

Step 3: Issue the Invoice

Step 4: Process Payment


๐Ÿ“‹ Invoices

Creating Invoices

Invoice with Discount & Tax

โš ๏ธ discount_type is required when discount > 0. No silent default โ€” the package throws an error if you provide a discount without specifying its type.

Invoice with Metadata

Line Items with Per-Line Tax & Discount

Adding Lines After Creation

Invoice Number Format

Customize in config:

Available placeholders: {prefix}, {year}, {month}, {sequence}

Examples: INV-2025-0001, INV-2025-06-0001

The generator automatically handles collisions with a bounded retry loop (max 10 attempts).


๐Ÿ”„ Invoice Lifecycle

Status Transitions

Operations

Invalid transitions throw InvoiceStatusTransitionException.

Overdue Status

Configure grace period:

Schedule the command in routes/console.php (Laravel 11+) or Console/Kernel.php:

Status Helpers

Financial Helpers

Query Scopes


๐Ÿ’ณ Payments

Record a Manual Payment

Mark Payment as Success/Failed

Create Checkout Session

Handle Webhooks

Refund

Payment Helpers


๐Ÿฆ Payment Gateways

Built-in Gateways

Gateway Status Description
LocalGateway โœ… Ready Auto-succeeds for local/testing
StripeGateway ๐Ÿ— Placeholder Requires stripe/stripe-php
BankTransferGateway โœ… Ready Manual admin verification

โš ๏ธ Stripe: throws RuntimeException if stripe/stripe-php is not installed. Install with composer require stripe/stripe-php.

Switch Default Gateway

Or via env: INVOICING_GATEWAY=stripe

Use a Specific Gateway per Payment

Add Custom Gateway โ€” Via Config

Add Custom Gateway โ€” Via Runtime

Custom Gateway Implementation

Gateway Manager API


๐Ÿฆ Bank Transfer (Manual Verification)

Flow

1. Customer Initiates

2. Admin Verifies or Rejects

3. Bank Details Config

Payment Status Flow

PaymentStatus Transitions

Invalid transitions throw PaymentStatusTransitionException.


๐Ÿ›ก๏ธ Exceptions

Exception Thrown When
InvoiceStatusTransitionException Invalid invoice status transition
PaymentStatusTransitionException Invalid payment status transition
PaymentVerificationException verify/reject on non-awaiting_verification payment
GatewayNotFoundException Unregistered gateway requested
InvalidPaymentAmountException Amount โ‰ค 0 or exceeds remaining balance

All extend standard PHP exceptions (RuntimeException / InvalidArgumentException) so they integrate naturally with Laravel's error handling.


๐Ÿ“ก Events

All events use public readonly properties (immutable after construction):

Event Property When
InvoiceCreated $invoice Invoice created
InvoiceUpdated $invoice Issued / totals recalculated
InvoicePaid $invoice Marked as paid
InvoiceCanceled $invoice Canceled
InvoiceRefunded $invoice Refunded
PaymentSucceeded $payment Payment succeeded
PaymentFailed $payment Payment failed
PaymentVerified $payment Admin verified bank transfer

Listening

Example Listener


๐Ÿšช Middleware

EnsureInvoicePaid

The invoice.paid middleware alias is auto-registered by the package's ServiceProvider (works in Laravel 11, 12, and 13). No manual registration needed.

Restrict route access by invoice payment status:

If you prefer manual registration, you can also add it in bootstrap/app.php:

Note: The auto-registration is preferred and works out of the box. Manual registration is only needed if you want to override the alias or have a conflicting alias name.


๐Ÿ”— HasInvoices Trait

All methods return MorphMany with proper return type declarations.


๐Ÿ‘ค User ID Tracking

Track who created/owns invoices and payments (independent from billable):

Custom User Model


๐Ÿงฎ Custom Calculators

Tax Calculator

Discount Calculator


๐Ÿ—ƒ๏ธ Database Schema

invoices

Column Type Notes
id bigint PK
billable_type string Polymorphic (nullable)
billable_id bigint Polymorphic (nullable)
user_id bigint Nullable, indexed (app adds FK)
tenant_id string Nullable, indexed
number string Unique
title string Required
description text Nullable
currency string(3) Default: USD
subtotal decimal(12,2) Sum of line totals
discount decimal(12,2) Discount amount
discount_type enum percentage / fixed (DiscountType cast)
tax decimal(12,2) Tax amount
total decimal(12,2) Final total
status enum draft/unpaid/paid/canceled/refunded/overdue
issued_at timestamp Nullable
due_at timestamp Nullable
paid_at timestamp Nullable
metadata json Nullable
created_at timestamp
updated_at timestamp
deleted_at timestamp Soft delete

invoice_lines

Column Type Notes
id bigint PK
invoice_id bigint FKโ†’invoices (restrictOnDelete)
description string Required
quantity integer Default: 1
unit_price decimal(12,2)
discount decimal(12,2) Per-line discount
tax decimal(12,2) Per-line tax
total decimal(12,2) (unit_price ร— qty) โˆ’ discount + tax
metadata json Nullable

payments

Column Type Notes
id bigint PK
invoice_id bigint FKโ†’invoices (restrictOnDelete)
user_id bigint Nullable, indexed (app adds FK)
gateway string e.g. manual, stripe, bank_transfer
transaction_id string Nullable
amount decimal(12,2) Must be > 0 and โ‰ค remaining balance
currency string(3)
status enum pending/awaiting_verification/success/failed/refunded
gateway_response json Nullable
proof_file string Nullable โ€” bank transfer receipt
proof_notes string Nullable โ€” customer/admin notes
verified_at timestamp Nullable โ€” admin verification time
verified_by bigint Nullable, indexed โ€” admin user ID (app adds FK)
created_at timestamp
updated_at timestamp

FK Constraints: user_id and verified_by are foreignId (unsignedBigInteger) columns with indexes but without constrained() because the target user table is configurable. The consuming application should add FK constraints in their own migrations. invoice_id uses restrictOnDelete to preserve the financial audit trail.


๐Ÿงช Testing

56 tests, 121 assertions covering:


๐Ÿ“š Documentation


๐Ÿ“ Changelog

See CHANGELOG.md for all changes.


๐Ÿ“„ License

MIT โ€” free to use in personal and commercial projects.


๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/my-feature)
  3. Commit your changes (git commit -am 'Add my feature')
  4. Push to the branch (git push origin feature/my-feature)
  5. Create a Pull Request

Please ensure all tests pass before submitting:


All versions of invoicing with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
laravel/framework Version ^11.0|^12.0|^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package salehye/invoicing contains the following files

Loading the files please wait ...