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 wrapper for WeasyPrint (v60+) to generate PDFs from URLs or HTML. Snappy-like API with output streaming or file generation, supports WeasyPrint CLI options (encoding, media type, stylesheets, attachments) and timeouts.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Dynamic Document Generation: Enables server-side PDF creation for invoices, receipts, reports, or user-generated content without client-side dependencies. Reduces reliance on proprietary tools (e.g., Adobe PDF Services) or outdated libraries like dompdf.
  • Roadmap Alignment:
    • Legacy Replacement: Directly replaces deprecated knplabs/snappy or abandoned barryvdh/laravel-snappy in Laravel ecosystems, ensuring compatibility with PHP 8.5+ and Symfony 8.0+.
    • CSS3 Support: Critical for modern web apps transitioning to PDF exports, supporting Flexbox, Grid, and responsive designs.
  • Build vs. Buy:
    • Buy: Ideal for teams needing quick integration of PDF generation with minimal dev overhead. Avoids maintenance of custom HTML-to-PDF pipelines.
    • Build: Only consider custom development if requiring advanced WeasyPrint features (e.g., OCR, custom fonts) or multi-PDF merging (unsupported here).
  • Use Cases:
    • B2B SaaS: Automated contract generation, compliance reports, or audit logs with consistent styling.
    • E-commerce: Dynamic order confirmations, shipping labels, or multi-page product catalogs.
    • Internal Tools: Converting web dashboards (e.g., analytics, CRM) into PDFs for offline review.
    • Legal/Regulatory: Generating pixel-perfect PDFs for tax forms, NDAs, or regulatory disclosures.
    • Marketing: A/B testing landing pages by exporting variations as PDFs for offline review.
    • Queue-Based Workflows: Integrates seamlessly with Laravel Queues for async PDF generation (e.g., bulk report exports).

When to Consider This Package

  • Adopt if:

    • Your stack is Laravel/PHP and requires a Snappy-compatible alternative (e.g., migrating from knplabs/snappy).
    • You need CSS3 support (Flexbox, Grid, responsive layouts) in generated PDFs—critical for modern web apps.
    • Your infrastructure supports Python (e.g., Docker, server with Python 3.8+ installed) to run WeasyPrint (version 60+).
    • You prioritize open-source (MIT license) with active maintenance (PHP 8.5+, Symfony 8.0+).
    • Use cases involve static or semi-dynamic content (e.g., templates with merged data, URLs, or HTML strings).
    • You require fine-grained control over PDF options (e.g., timeouts, metadata, attachments, or debug modes).
    • Your team lacks resources to maintain a custom HTML-to-PDF solution.
  • Look elsewhere if:

    • You need multi-PDF merging (this package only supports single-source generation).
    • Your environment cannot run Python (e.g., serverless functions without Python support).
    • You require advanced features like OCR, form filling, or digital signatures (consider PDFtk or Adobe PDF Services).
    • You need real-time previews (this is server-side only; consider client-side libraries like pdf-lib for interactive PDFs).
    • Your use case involves highly dynamic content (e.g., live data tables) where HTML rendering may fail (consider headless Chrome alternatives like Puppeteer).
    • You’re constrained by cost (WeasyPrint requires Python installation, which may add infrastructure complexity).

How to Pitch It (Stakeholders)

For Executives: "This package lets us generate high-quality PDFs directly from our web content—no third-party APIs or client-side dependencies. It’s a drop-in replacement for outdated tools like Snappy, supports modern CSS (critical for our responsive designs), and integrates seamlessly with Laravel. For example, we can automate invoice generation, compliance reports, or user exports without adding latency or cost. It’s open-source, actively maintained, and reduces our reliance on proprietary solutions."

For Engineering: *"PhpWeasyPrint is a Snappy-compatible wrapper for WeasyPrint, offering:

  • Modern PHP/Laravel support (PHP 8.5+, Symfony 8.0+).
  • CSS3 rendering (Flexbox, Grid) for pixel-perfect PDFs.
  • Fine-grained control over PDF options (timeouts, metadata, attachments).
  • Async-friendly (works with Laravel Queues, Supervisor, etc.).
  • Security patches (e.g., CVE-2023-28115 mitigated).

Trade-offs:

  • Requires Python (WeasyPrint dependency) on your servers.
  • No multi-PDF merging (single-source only).
  • Not a client-side solution (server-side only).

Proposal: Replace knplabs/snappy or dompdf with this for all new PDF generation needs. For existing projects, prioritize migration where CSS3 support or Snappy compatibility is needed. Pair with Laravel Queues for async generation (e.g., bulk reports)."*

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.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope