Download the PHP package finller/laravel-invoices without Composer

On this page you can find all versions of the php package finller/laravel-invoices. 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 laravel-invoices

Everything You Need to Manage Invoices in Laravel

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package provides a robust, easy-to-use system for managing invoices within a Laravel application, with options for database storage, serial numbering, and PDF generation.

laravel-invoices

Demo

Try out the interactive demo to explore package capabilities.

Table of Contents

  1. Requirements

  2. Installation

  3. The Invoice Eloquent Model

    • Storing an Invoice in Your Database
    • Automatically Generating Unique Serial Numbers
    • Managing Multiple Prefixes and Series
    • Customizing the Serial Number Format
    • Displaying Your Invoice as a PDF
    • Attaching Your Invoice to an Email
    • Customizing the PDF Invoice
    • Adding a Dynamic Logo
  4. The PdfInvoice Class

    • Rendering the Invoice as a PDF
    • Rendering the Invoice in a View
  5. Customization
    • Customizing the Font
    • Customizing the Template

Requirements

Installation

You can install the package via composer:

You can publish and run the migrations with:

You can publish the config file with:

This is the contents of the published config file:

The Invoice Eloquent Model

Storing an Invoice in Your Database

You can store an Invoice in your database using the Eloquent Model: Elegantly\Invoices\Models\Invoice.

[!NOTE] Don't forget to publish and run the migrations

Here is a full example:

Automatically Generating Unique Serial Numbers

This package provides a simple and reliable way to generate serial numbers automatically, such as "INV240001".

You can configure the format of your serial numbers in the configuration file. The default format is PPYYCCCC, where each letter has a specific meaning (see the config file for details).

When invoices.serial_number.auto_generate is set to true, a unique serial number is assigned to each new invoice automatically.

Serial numbers are generated sequentially, with each new serial number based on the latest available one. To define what qualifies as the previous serial number, you can extend the Elegantly\Invoices\Models\Invoice class and override the getPreviousInvoice method.

By default, the previous invoice is determined based on criteria such as prefix, series, year, and month for accurate, scoped numbering.

Managing Multiple Prefixes and Series

In more complex applications, you may need to use different prefixes and/or series for your invoices.

For instance, you might want to define a unique series for each user, creating serial numbers that look like: INV0001-2400X, where 0001 represents the user’s ID, 24 the year and X the index of the invoice.

[!NOTE] When using IDs for series, it's recommended to plan for future growth to avoid overflow. Even if you have a limited number of users now, ensure that the ID can accommodate the maximum number of digits allowed by the serial number format.

When creating an invoice, you can dynamically specify the prefix and series as follows:

Customizing the Serial Number Format

In most cases, the format of your serial numbers should remain consistent, so it's recommended to set it in the configuration file.

The format you choose will determine the types of information you need to provide to configureSerialNumber.

Below is an example of the most complex serial number format you can create with this package:

Displaying Your Invoice as a PDF

The Invoice model has a toPdfInvoice() that return a PdfInvoice class.

You can stream the PdfInvoice instance as a response, or download it:

Attaching Your Invoice to an Email

The Invoice model provide a toMailAttachment method making it easy to use with Mailable

Customizing the PDF Invoice

To customize how your model is converted to a PdfInvoice, follow these steps:

  1. Create a Custom Model: Define your own \App\Models\Invoice class and ensure it extends the base \Elegantly\Invoices\Models\Invoice class.

  2. Override the toPdfInvoice Method: Implement your specific logic within the toPdfInvoice method to control the customization.

  3. Update the Configuration File: Publish the package configuration file and update the model_invoice key as shown below:

Adding a Dynamic Logo

If you need to set the logo dynamically on the invoice, for example, when allowing users to upload their own logo, you can achieve this by overriding the getLogo method. Follow the steps outlined in the Customizing the PDF Invoice section to create your own Model.

To dynamically set the logo, define the getLogo method as shown below:

[!NOTE]
The returned value must be either a base64-encoded data URL or a path to a locally accessible file.

The PdfInvoice Class

This package includes a standalone PdfInvoice class, making it easy to render invoices as a PDF or directly within a view.

You can even use this package exclusively for the PdfInvoice class if that suits your needs.

Here’s an example of a fully configured PdfInvoice instance:

Rendering the Invoice as a PDF

In a Controller

In a Livewire Component

Store in a file

Rendering the Invoice in a View

You can render your invoice within a larger view, enabling you to create an "invoice builder" experience similar to the interactive demo.

To achieve this, include the main part of the invoice in your view as shown below:

This approach allows you to seamlessly integrate the invoice into a dynamic and customizable user interface.

[!NOTE]
The default template is styled using Tailwind-compatible syntax, making it seamlessly compatible with websites that use Tailwind.
If you don’t use Tailwind, the styling may not render as intended.

Customization

Customizing the Font

See the Dompdf font guide.

Customizing the Template

To customize the invoice template, you can publish the provided views and modify them as needed.

Alternatively, you can create a completely custom template. Ensure that your custom template follows the same structure and conventions as the default one to maintain compatibility with various use cases.

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-invoices with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
dompdf/dompdf Version ^3.1
elegantly/laravel-money Version ^2.1.0
illuminate/contracts Version ^11.0||^12.0
spatie/laravel-package-tools Version ^1.14
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 finller/laravel-invoices contains the following files

Loading the files please wait ....