Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Php Weasyprint Laravel Package

pontedilana/php-weasyprint

PHP 8.3+ wrapper around WeasyPrint (v60+) to generate PDFs from URLs or HTML. Snappy-inspired, drop-in style API with strict typing. Set the weasyprint binary, pass CLI options, stream to browser or write files.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Dynamic PDF Generation: Enables on-demand PDF creation for invoices, reports, or user-generated content (e.g., "Print as PDF" buttons).
  • Cost-Effective Alternative to Commercial Tools: Replaces paid services like SnappyPDF or Dompdf for high-volume use cases (e.g., e-commerce receipts, legal documents).
  • Legacy System Modernization: Integrates with older PHP/Laravel apps to add PDF export without full stack rewrites.
  • Compliance & Accessibility: Supports PDF/A-3b (archival) and XMP metadata for regulatory compliance (e.g., healthcare, finance).
  • Queue-Based Processing: Offers timeout control for async PDF generation (e.g., background jobs in Laravel Queues).
  • Security Hardening: Mitigates SSRF, command injection, and PHAR deserialization risks (critical for SaaS platforms).

When to Consider This Package

Adopt if:

  • You need high-fidelity HTML-to-PDF (tables, CSS, JavaScript rendering) with WeasyPrint’s accuracy.
  • Your stack is PHP 8.3+ and Laravel/Symfony (or compatible with Symfony Process).
  • You require PDF/A compliance or XMP metadata (e.g., for archival or legal use).
  • You can pre-install WeasyPrint (60+) on your servers (Docker, Linux, or Windows WSL).
  • You prioritize security (SSRF protections, shell injection fixes).

Look elsewhere if:

  • You need multi-page merging (use Dompdf or SnappyPDF).
  • Your environment lacks Python/WeasyPrint (e.g., serverless cold starts).
  • You require low-latency (WeasyPrint adds ~1–3s overhead vs. headless Chrome).
  • You’re on PHP < 8.3 or need Windows-native support (WeasyPrint’s Windows support is limited).
  • You need interactive PDFs (forms, JavaScript) beyond basic rendering.

How to Pitch It (Stakeholders)

For Executives: "This package lets us generate professional PDFs from web content—like invoices, reports, or legal docs—without third-party APIs or expensive tools. It’s secure, cost-effective, and integrates seamlessly with our Laravel stack. For example, we could add a ‘Download PDF’ button to every order confirmation, reducing support calls and improving compliance. The upfront cost is minimal (WeasyPrint installation), and it future-proofs our PDF needs for years."

For Engineers: *"PhpWeasyPrint is a SnappyPDF drop-in replacement but uses WeasyPrint for superior CSS/HTML fidelity. Key advantages:

  • Type-safe API (PHP 8.3+).
  • Security-first: SSRF protections, shell injection fixes, and PHAR hardening.
  • Queue-friendly: Timeout control for async jobs.
  • Modern features: PDF/A, XMP metadata, and WeasyPrint’s latest options. Tradeoff: Requires WeasyPrint (Python dependency), but we can containerize it. Example use case: Replace our hacky Dompdf setup for invoices with this—better rendering, same effort."*

For Security Teams: *"This package addresses critical risks:

  • SSRF/LFD: Only http/https URLs are fetched by default (configurable).
  • Command Injection: Uses Symfony Process’s safe execution (no shell).
  • PHAR Bypass: Output paths are validated against allow-lists. Recommendation: Audit the WeasyPrint binary path and allowed schemes in production."*
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi