docdigital/pdf-manager
PdfManager is a lightweight PHP/Laravel component for basic PDF management. Merge multiple PDFs into one or split a PDF into separate files, making common document workflows simple to automate in your app.
mergePdfJob).merge(), split()), which simplifies integration but may require wrapper classes for:
config/pdf-manager.php (if provided) should allow customization of:
sys_get_temp_dir() vs. custom storage).Allowed memory exhausted errors.composer.lock in the repo may lead to inconsistent dependency versions across environments.unlink() or storage disk cleanup is implemented.spatie/pdf-temporary-file) or PDFtk (via barryvdh/laravel-snappy) be more robust for production use?config/app.php and publish config if available.PdfManager::merge() directly in controllers or wrap in a repository pattern for abstraction.storage:disk) for temp files or direct uploads.fpdf/tcpdf versions in composer.json to avoid breaking changes:
"require": {
"setasign/fpdf": "^2.3",
"tecnickcom/tcpdf": "^6.5"
}
use Juanmf\PdfManager\Facades\PdfManager;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
class MergePdfJob implements ShouldQueue
{
use Queueable;
public function handle()
{
PdfManager::merge(['file1.pdf', 'file2.pdf'], 'merged.pdf');
}
}
mime-type or pdfinfo) before passing to the package.if (!Str::endsWith($file->getClientOriginalExtension(), '.pdf')) {
throw new \InvalidArgumentException('Only PDF files are allowed.');
}
try {
PdfManager::merge($files, $outputPath)->timeout(300); // 5 minutes
} catch (TimeoutException $e) {
// Retry or notify user
}
Storage::delete()).fpdf/tcpdf for security patches (e.g., CVE fixes).PdfManager::logMergeOperation()).PDF_MERGE_FAILED).ini_set('memory_limit', '512M')).memory_limit or split PDFs into smaller chunks.pdfinfo or Ghostscript to validate inputs.debugbar to inspect memory/CPU usage.PdfManager operations to a dedicated table for auditing.supervisor/systemd) to handle concurrent PDF jobs.memory_limit and max_execution_time for monolithic setups.| Failure Scenario | Impact | Mitigation | |--------------------------------|-------------------------------------|
How can I help you explore Laravel packages today?