Download the PHP package stitch-digital/laravel-pdfmerger without Composer
On this page you can find all versions of the php package stitch-digital/laravel-pdfmerger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download stitch-digital/laravel-pdfmerger
More information about stitch-digital/laravel-pdfmerger
Files in stitch-digital/laravel-pdfmerger
Package laravel-pdfmerger
Short Description Modern PDF merger for Laravel with fluent API and full type safety
License MIT
Homepage https://github.com/stitch-digital/laravel-pdfmerger
Informations about the package laravel-pdfmerger
Laravel PDFMerger
A modern, fluent PDF merger for Laravel with full type safety and an elegant API. Merge multiple PDF files with ease using a developer-friendly interface.
Features
- ๐ Modern PHP: Built for PHP 8.2+ with strict types
- ๐ฏ Fluent API: Chainable methods following Laravel conventions
- ๐ Type Safe: Full type hints and return types for better IDE support
- ๐ URL Support: Add PDFs from both local paths and remote URLs
- ๐จ Enum Support: Use
Orientationenum for better developer experience - ๐จ Laravel 10-11: Compatible with Laravel 10 and 11
- ๐ฆ Auto-Discovery: Zero configuration with Laravel package auto-discovery
- ๐งช Fully Tested: Comprehensive test suite with PHPUnit
- ๐ Well Documented: Clear examples and inline documentation
Requirements
- PHP 8.2 or higher
- Laravel 10.0 or 11.0
Installation
Install the package via Composer:
The package will automatically register itself via Laravel's package discovery.
Publish Configuration (Optional)
You can publish the configuration file if you want to customize default settings:
Usage
Basic Example
Fluent API with Method Chaining
Selecting Specific Pages
Using Named Parameters (PHP 8.0+)
Setting Orientation
You can set orientation using strings or the Orientation enum for better IDE support and type safety:
Duplex Printing Support
Add blank pages between documents to support double-sided printing:
Working with String Content
Using URLs (Remote PDFs)
The package can automatically download and merge PDFs from remote URLs:
Downloaded PDFs are automatically stored in temporary files and cleaned up after the merge operation completes.
URL Security Configuration
URL downloads can be configured in config/pdfmerger.php:
Automatic Local Development Support:
SSL verification is automatically disabled when APP_ENV=local, making it work seamlessly with local domains like .test, .local, or self-signed certificates. No configuration needed!
For production environments, SSL verification is automatically enabled when APP_ENV=production, ensuring secure connections.
You can override this behavior in your .env if needed:
Security Notes:
- URL downloads are enabled by default but can be disabled via configuration
- SSL certificate verification is automatically managed based on environment (
localvsproduction) - SSL verification is always disabled in local environments for developer convenience
- SSL verification is always enabled in production for security (unless explicitly overridden)
- Downloaded files are stored in temporary storage and automatically cleaned up
- Consider disabling URL support (
allow_urls => false) in security-sensitive environments - Only use URLs from trusted sources to prevent potential security risks
Output Methods
Method Aliases for Better Readability
Adding Multiple Files at Once
Conditional Operations
Using Tap for Side Effects
Setting Custom Filename
Resetting the Merger
Error Handling
The package throws specific exceptions for different error scenarios:
Configuration
The published configuration file (config/pdfmerger.php) allows you to customize:
- temp_path: Directory for temporary files
- output_path: Default output directory
- orientation: Default page orientation ('P' or 'L')
- duplex: Enable duplex mode by default
- memory_limit: Memory limit for large files (in MB)
- allow_urls: Enable/disable URL downloads (default:
true) - url_download_timeout: Timeout for URL downloads in seconds (default:
30) - url_verify_ssl: Verify SSL certificates for HTTPS URLs (default:
true) - disk: Default Storage disk for integration
Extending with Macros
You can extend the package with custom methods using macros:
Upgrading from v1.x
See UPGRADING.md for detailed upgrade instructions.
Key Breaking Changes
- Minimum PHP version is now 8.2
- Minimum Laravel version is now 9.0
init()is deprecated, usemake()insteadmerge()now returnsselfinstead ofvoidfor chaining- Hungarian notation removed from internal properties
Testing
Run the test suite:
Run with coverage:
Code Quality
Check code style:
Fix code style:
Run static analysis:
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
- Stitch Digital - Current Maintainer
- Webklex - Original Author
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-pdfmerger with dependencies
illuminate/support Version ^12.0|^13.0
illuminate/http Version ^12.0|^13.0
illuminate/filesystem Version ^12.0|^13.0
setasign/fpdf Version ^1.8
setasign/fpdi Version ^2.6