thirtybittech / invoicematic
A Statamic addon for generating professional PDF invoices with dynamic content and seamless CMS integration.
Installs: 5
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Type:statamic-addon
Requires
- php: ^8.1
- barryvdh/laravel-dompdf: ^3.1
- statamic/cms: ^5.0
Requires (Dev)
- orchestra/testbench: ^9.0
README
Invoicematic is a professional-grade, paid Statamic addon that automatically generates beautiful, PDF-based invoices when entries are created in your collections (e.g., orders, registrations, bookings).
Built with flexibility, configurability, and real-world invoicing needs in mind.
โก๏ธ Quick Setup
-
Install:
composer require thirtybittech/invoicematic
-
Generate blueprint (optional):
php artisan invoicematic:setup-collection orders
-
Use:
- Create a new entry in your collection
- Invoice PDF auto-generated (and emailed if configured)
๐ Features
- ๐ Automatically generate PDF invoices from collection entries
- ๐ง Optionally email the PDF invoice to the customer (SMTP required)
- ๐ Artisan command to auto-generate a collection blueprint for orders
- ๐จ Customizable Blade templates with full HTML/CSS control for both invoice & email template
- ๐ Supports multiple collections with independent field mapping
- ๐ Prevents duplicate generation with smart toggles
- ๐พ Auto-saves PDFs to your storage (configurable path)
- ๐ง Dynamic field mapping โ no hardcoded field handles
- ๐ฐ Built-in currency formatting support
- ๐ง Customizable company/sender details
- โ Fully Statamic-native; no external dependencies required beyond DomPDF
๐ผ Use Cases
- Ecommerce Order Invoices
- Event Registration Receipts
- Booking Confirmations
- Donation Receipts
๐ธ Paid Addon Notice
This is a commercial addon. A valid license is required to use it in production.
To obtain a license, visit Statamic Addone or contact contact@30-bit.com.
๐ฆ Installation
composer require thirtybittech/invoicematic
Publish the config:
php artisan vendor:publish --tag=invoicematic-config
Optionally publish the default Blade template:
php artisan vendor:publish --tag=invoicematic-views
After publishing, you can customize the templates under:
resources/views/vendor/invoicematic/templates/default.blade.php
(for invoices)resources/views/vendor/invoicematic/emails/invoice.blade.php
(for emails)To use custom templates, update the
templates
andemail_template
keys inconfig/invoicematic.php
accordingly.
โ๏ธ Configuration
Edit config/invoicematic.php
:
๐บ Field Aliases (Flexible Mapping)
Configure how your fields map to canonical invoice fields:
'field_aliases' => [ 'orders' => [ // Required fields 'order_number' => ['order_number','order_id', 'id'], 'customer_name' => ['customer_name','client_name', 'name'], 'customer_email' => ['customer_email','email', 'contact_email'], 'items' => ['items', 'products', 'line_items'], 'item_fields' => [ 'name' => ['name', 'product_name', 'title'], 'quantity' => ['quantity', 'qty', 'amount'], 'price' => ['price', 'unit_price', 'cost'], ], 'total' => ['total','amount', 'grand_total'], 'currency' => ['currency','currency_code'], // Optional metadata 'tax' => ['tax', 'vat_amount'], 'subtotal' => ['subtotal'], 'paid' => ['paid' , 'is_paid', 'payment_status'], 'date' => ['date' ,'order_date', 'created_at'], 'note' => ['notes', 'message', 'comment'], ], ],
You can define multiple collections (
orders
,registrations
, etc.) with their own mappings.
๐ข Company Info
Used across all invoices:
'company' => [ 'name' => 'Your Company Name', 'address' => [ 'line1' => '123 Business Rd', 'line2' => null, 'city' => 'City', 'country' => 'Country', ], 'email' => 'email@company.com', 'footer_message' => 'Thank you for your business', 'company_logo' => null, ],
๐พ Storage & Filename
'storage_path' => storage_path('app/invoices'), 'filename_format' => '{collection}_{order_number}.pdf',
Filenames are automatically made unique by the system.
๐ฑ Currency Formatting
'currency' => [ 'default' => 'USD', 'format' => [ 'USD' => ['symbol' => '$', 'decimal' => 2], 'EUR' => ['symbol' => 'โฌ', 'decimal' => 2], ], ],
๐ง How It Works
-
User creates a new entry in a configured collection (e.g.,
orders
) -
Event is triggered
-
If invoice hasn't been generated:
-
Fields are resolved based on alias config
-
PDF is created & saved to storage
-
Optionally is sent to the user with invoice
-
Entry is updated with:
invoice_generated = true
invoice_path = /path/to/invoice.pdf
-
๐งช Testing
You can manually test by:
- Creating an entry in the target collection
- Verifying that the PDF is saved under
storage_path
- Ensuring
invoice_generated
andinvoice_path
fields are set on the entry
๐ง Artisan Commands
Generate Order Collection Blueprint
You can quickly scaffold a blueprint for an orders
collection using:
php artisan invoicematic:setup-collection orders
This generates a blueprint with the necessary fields (order_number, customer_name, items, etc.).
๐ Requirements
- PHP 8.1+
- Statamic 5.x
- SMTP configured (for emailing invoices. Optional)
Limitations
- This addon does not calculate values such as
subtotal
,total
, ortax
. - All values will be used as-is in the entry; they must be pre-calculated before being passed to the addon.
๐ฉ Support
Need help or a custom integration? Contact contact@30-bit.com
๐ License
This is a paid addon. Redistribution or use without a valid license is prohibited.