Download the PHP package kenod/invoice-generator without Composer
On this page you can find all versions of the php package kenod/invoice-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kenod/invoice-generator
More information about kenod/invoice-generator
Files in kenod/invoice-generator
Package invoice-generator
Short Description Professional PHP library for generating PDF invoices, proforma invoices, and other accounting documents with QR payment codes, IBAN validation, and multi-language support
License MIT
Informations about the package invoice-generator
Invoice Generator
Professional PHP library for generating PDF invoices, proforma invoices, credit notes, and other accounting documents with QR payment codes, IBAN validation, and multi-language support.
Migrating from v2.x? See the Migration Guide for step-by-step instructions.
Links
- Official Website: https://faktury.chci-www.cz/
- Interactive Demo: https://fakturasnadno.cz/ - Try creating invoices with various options
- GitHub Repository: https://github.com/kenod/invoice-generator
- Packagist: https://packagist.org/packages/kenod/invoice-generator
Features
- Multiple Document Types: Invoice, Proforma, Credit Note, Storno
- VAT Calculations: Support for multiple VAT rates with automatic calculations
- QR Payment Codes: Generate Czech QR payment codes (SPD format)
- IBAN Validation: Validate and format Czech IBAN numbers
- Electronic Signatures: PDF digital signature support
- Multi-language: Easy localization with translation files
- Professional Styling: Customizable colors, fonts, and branding
- Barcode Support: 1D and 2D barcode generation
- Customizable Margins: Adjustable top margin and signature area spacing
- Type Safety: Full PHP 8.3+ type hints and strict types
- Unit Tested: Comprehensive test coverage with PHPUnit
Requirements
- PHP 8.3, 8.4 or 8.5
- TCPDF library (automatically installed via Composer)
- GD extension (for image handling)
Installation
Quick Start
Complete API Reference
InvoiceGenerator Class
Main class for generating invoices.
Core Methods
Settings Class
Accessed via $invoice->getSettings(). All methods return $this for chaining.
Basic Settings
PDF Metadata
Financial Settings
VAT Settings
Display Options
Styling
Page Margins
Images and Branding
QR Payment Codes
Barcodes
Electronic Signature
Final Recipient
Additional Information
Utility Methods
Address Class
Used for supplier, customer, and final recipient. Accessed via $invoice->getSupplier(), $invoice->getCustomer(), $invoice->getEndRecipient().
Information Class
Invoice information. Accessed via $invoice->getInformation().
PaymentDetails Class
Payment details. Accessed via $invoice->getPaymentDetails().
Iban Class
Static utility class for IBAN operations.
Translator Class
Static utility class for translations.
Advanced Usage Examples
Multiple Document Types
Complex Invoice with All Features
Reverse Charge Invoice
Getting Price Information
Testing
The library includes comprehensive unit tests with PHPUnit.
Running Tests
Test Coverage
The library includes 93 tests with 280 assertions covering:
- InvoiceGenerator: Basic invoice generation, price calculations, VAT handling, discounts, rounding, deposits, reverse charge
- Settings: Configuration options, fluent interface, type safety, all setter/getter methods
- Address: All address fields and translation
- Information: Date handling and custom parameters
- PaymentDetails: Payment method configuration
- InvoiceItem: All item properties and setters
- Translator: Translation loading, key lookup, fallbacks
- Comprehensive: All features working together, multi-document generation, clearData()
- Price Calculations: Non-VAT payer, VAT payer, multiple rates, discounts, deposits, rounding
All tests use strict type checking and follow PHPUnit 11 best practices.
Code Quality
This library follows strict coding standards and includes automated quality checks:
Quality Tools
- PHPStan Level 8: Strictest static analysis
- PHP CodeSniffer: PSR-12 + Slevomat Coding Standard
- PHPUnit 11: Latest testing framework
- Strict Types:
declare(strict_types=1)on all files
Localization
The library includes Czech (cs), Slovak (sk), and English (en) translations.
Available Translation Keys
All translation keys use English snake_case format:
Creating Custom Translations
Migration from Version 2.x
If you're upgrading from the old WFPfaktury class, please read the complete Migration Guide which includes:
- Complete property name mapping
- Complete method name mapping
- Step-by-step migration instructions
- Side-by-side code comparisons
- List of removed deprecated methods
Quick example:
Old code (v2.x):
New code (v3.0):
Key Changes:
- Namespace:
WFPfaktury→Kenod\InvoiceGenerator - Main class:
WFPfaktury→InvoiceGenerator - All method names now use camelCase:
SetX()→setX() - All property names translated to English
- PHP 8.3+ required
- Deprecated methods removed
- Email functionality removed (use external library)
See MIGRATION.md for complete details.
Examples
See the examples/ directory for complete working examples:
01_basic_invoice.php- Simple invoice with minimal setup02_eet.php- Invoice with Electronic Registration of Sales (EET)03_reverse_charge.php- Reverse charge invoice04_translations.php- Using different languages05_eco_print.php- Eco-friendly compact layout06_images.php- Adding logos and images07_custom_callback.php- Custom PDF modifications08_english.php- English language invoice09_multiple_documents.php- Multiple documents in one PDF10_credit_note.php- Credit note with all features11_comprehensive.php- Comprehensive test with all available features
See the examples README for detailed descriptions of each example.
Performance Tips
- Reuse instance: Create one
InvoiceGeneratorinstance and useclearData()between invoices - Disable features: Turn off unused features (QR codes, barcodes, signatures) for faster generation
- Optimize images: Use compressed images with appropriate dimensions
- Font subsetting: Enabled by default, reduces PDF size
- Batch processing: Generate multiple invoices in one script execution
Troubleshooting
Common Issues
PDF not generating:
- Check that TCPDF is installed:
composer show tecnickcom/tcpdf - Verify PHP version:
php -v(must be 8.3+) - Check error logs for TCPDF errors
QR codes not showing:
- Verify account number format (with bank code)
- Check that amount is > 0
- Ensure QR payment is enabled:
setQRPayment(true, ...)
Images not displaying:
- Check file path is absolute or correct relative path
- Verify GD extension is installed:
php -m | grep -i gd - Supported formats: PNG, JPG, GIF
Wrong language:
- Ensure language file exists in
langs/directory - Call
setLanguage()before any translation occurs - Check translation key names (use English snake_case)
License
This project is licensed under the MIT License.
You are free to use, modify, and distribute this library in your commercial and non-commercial projects.
See the LICENSE file for full details.
Author
- Petr Daněk - Original author
- Email: [email protected]
- Website: https://www.danekpetr.cz
Credits
- Built on TCPDF library
- Refactored for PHP 8.3+ compatibility
- Follows Slevomat Coding Standard
Support
For issues and feature requests, please use the GitHub issue tracker.
Version
Current version: 3.0.9
Changelog
3.0.9
- Fixed QR payment SPAYD string missing the currency (
CC) parameter; the currency from settings is now included (ISO 4217), so banking apps no longer default to CZK
3.0.8
- Added
setDisplayDeposits()— hide the paid advances (deposits) row when it is disabled and the deposit amount is zero; the "total to pay" box shifts up to fill the gap. Non-zero deposits are always shown.
3.0.6
- Added PHP 8.5 support
- Added
setMarginTop()— configurable top margin for page content (first page only or all pages), useful for larger logos in the header area - Added
setSignatureMarginTop()— extra vertical space above the signature line for larger stamps or seals - Both margin settings are fully integrated with automatic page break calculations
3.0.5
- Fixed QR payment generation from bank account number
3.0.4
- VAT rate for items without a predefined VAT rate will be assigned dynamically
3.0.3
- Added 3 new languages (DE, HU, PL) translations
- Footer middle text added to translations
3.0.2
- Fixed
setRounding(0)bug - Added
modifyTranslations()method in Translator - Added
setHideFooterTexts()method in Settings
3.0.0
- Complete refactoring for PHP 8.3+, English API, type safety, unit tests
2.x
- Legacy WFPfaktury implementation