Download the PHP package mikailfaruqali/invoice-template without Composer
On this page you can find all versions of the php package mikailfaruqali/invoice-template. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mikailfaruqali/invoice-template
More information about mikailfaruqali/invoice-template
Files in mikailfaruqali/invoice-template
Package invoice-template
Short Description A powerful Laravel package for generating professional PDF invoices with customizable templates. Features advanced header/footer support, multi-language capabilities, and a comprehensive template management system powered by wkhtmltopdf via Snappy PDF generator.
License MIT
Homepage https://github.com/mikailfaruqali/invoice-template
Informations about the package invoice-template
Laravel Invoice Template Package
A powerful Laravel package for generating professional PDF invoices with customizable templates. Features advanced header/footer support, multi-language capabilities, and a comprehensive template management system powered by wkhtmltopdf via Snappy PDF generator.
Features
🎨 Template Management
- Database-driven templates with full CRUD operations
- Multi-language support with locale-based template selection
- Page-specific templates using customizable slugs (invoice, receipt, summary, etc.)
- Visual template editor with live preview capabilities
- Password-protected content editing for security
📄 PDF Generation
- Professional PDF output using wkhtmltopdf engine
- Customizable headers and footers with Blade template support
- Multiple paper sizes (A4, A5, A3, Letter, Legal)
- Portrait and landscape orientations
- Precise margin control (top, bottom, left, right)
- Header/footer spacing configuration
🌐 Internationalization
- Multi-language template support
- RTL/LTR text direction handling
- Locale-based template fallback system
- Session-based direction configuration
⚙️ Advanced Configuration
- Comprehensive PDF options (DPI, image quality, compression, etc.)
- Custom font support with font directory configuration
- Flexible middleware for route protection
- Configurable table names and route prefixes
- Cross-platform binary support (Windows/Linux)
🔒 Security
- Password protection for template content modifications
- Middleware-based access control
- Secure file generation with unique filenames
- CSRF protection on all forms
Installation
Requirements
- PHP >= 7.4
- Laravel >= 5.0
- wkhtmltopdf binary installed on your system
Step 1: Install the Package
Step 2: Install wkhtmltopdf
Windows
Download and install wkhtmltopdf from official website
Ubuntu/Debian
CentOS/RHEL
Step 3: Publish Assets
This will publish:
- Configuration file:
config/snawbar-invoice-template.php
- Migration file:
database/migrations/2025_08_20_000001_create_invoice_templates_table.php
Step 4: Run Migrations
Step 5: Configure wkhtmltopdf Binary Path
Edit config/snawbar-invoice-template.php
:
Configuration
Basic Configuration
Advanced PDF Options
Usage
Template Management Interface
Access the template management interface at:
The interface provides:
- Create, edit, and delete templates
- Live preview of template changes
- Multi-language template management
- Page slug organization
- Margin and spacing configuration
Basic PDF Generation
Page-Specific Templates
Advanced Usage with Headers and Footers
Custom PDF Options
Working with Multiple Languages
Programmatic Template Creation
Template Data Variables
Templates have access to default variables:
Template Examples
Invoice Header Template
Invoice Content Template
Invoice Footer Template
API Endpoints
The package provides RESTful API endpoints:
Method | URI | Action | Description |
---|---|---|---|
GET | /invoice-templates |
index | Template management interface |
GET | /invoice-templates/get-data |
getData | Get all templates (JSON) |
POST | /invoice-templates/store |
store | Create new template |
PUT | /invoice-templates/update/{id} |
update | Update existing template |
DELETE | /invoice-templates/delete/{id} |
destroy | Delete template |
API Usage Examples
Database Schema
The package creates a invoice_templates
table with the following structure:
Troubleshooting
Common Issues
1. wkhtmltopdf not found
Solution: Ensure wkhtmltopdf is installed and the binary path is correctly configured.
2. Permission denied when saving PDFs
Solution: Ensure the public/files
directory is writable:
3. Template not found
Solution: Create a default template or ensure templates exist for your page slugs.
4. CSRF token mismatch
Solution: Ensure CSRF token is included in AJAX requests:
Performance Optimization
- Use template caching for frequently used templates
- Optimize images before including in templates
- Minimize CSS and HTML in templates
- Use appropriate DPI settings based on your needs
Security Considerations
- Always validate input when creating templates programmatically
- Use password protection for content editing in production
- Sanitize user input in template content
- Restrict access using appropriate middleware
- Validate file paths when working with logos and assets
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Development Setup
- Clone the repository
- Install dependencies:
composer install
- Run tests:
composer test
- Check code style:
composer pint
Changelog
Please see CHANGELOG for more information on what has changed recently.
Security
If you discover any security-related issues, please email [email protected] instead of using the issue tracker.
Credits
- Mikail Faruq Ali
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
Support
If you find this package helpful, please consider:
- ⭐ Starring the repository
- 🐛 Reporting bugs
- 💡 Suggesting new features
- 📖 Improving documentation
Built with ❤️ for the Laravel community