Weave 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 Phantomjs Laravel Package

jonnyw/php-phantomjs

PHP PhantomJS is a headless browser wrapper for PHP that lets you load pages, run JavaScript, capture screenshots, and export to PDF. It provides a clean, extensible API over the PhantomJS binary, supports custom scripts, and works with any PHP project.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

What it actually unlocked: jonnyw/php-phantomjs was a thin PHP wrapper around PhantomJS — a headless WebKit browser. As a PM, the decisions it informed were almost always "can we do X from our PHP/Laravel backend without a separate service?" The answer it enabled was usually yes for four recurring jobs:

  • Server-rendered screenshots of your own UI — visual regression checks, shareable preview cards, og:image generation, email/PDF previews.
  • HTML → PDF generation — invoices, statements, reports, tickets. PhantomJS's print-to-PDF path was a common escape hatch before Chrome headless matured.
  • Scraping and capturing JS-rendered pages — anything where the data only exists after client-side execution and curl/Guzzle returns an empty shell.
  • End-to-end smoke checks in CI — "does the page load and is this element present" style assertions, driven from PHPUnit.

Feature/roadmap framing today: this is a deprecation and migration decision, not an adoption decision. PhantomJS itself was discontinued in 2018, and this package was archived the same year with no releases since. Any roadmap item that depends on it should be treated as carrying unmitigated risk — no security patches, no PHP 8.x compatibility guarantee, no upstream bugfixes, and a shrinking pool of anyone who can maintain it. The score (~19.9) and negligible dependent count reflect that: this is a historical artifact, not a live dependency.

Build vs. buy: the relevant comparison has shifted. The decision is no longer "build a headless browser integration ourselves vs. use this wrapper" — it's "use a maintained wrapper around Chrome/Chromium (Browsershot + Puppeteer, or Playwright, or a hosted rendering API) vs. keep a dead runtime alive." Buying/adopting a maintained path is cheaper on every axis that matters: security, hiring, and PHP version support.

Where it still shows up in decisions: as a migration inventory item. If it's in your composer.json, the PM question is "which user-facing features actually depend on this, and what's the cost of switching each one?" Typical answer: PDF generation and screenshot endpoints move cleanly to headless Chrome; anything relying on PhantomJS-specific rendering quirks needs a visual diff pass.

When to Consider This Package

Consider it only in these narrow cases:

  • You are already running it in production and need a short-term, time-boxed stopgap while you plan the migration — pin the version, isolate it behind an interface, and treat it as frozen.
  • You are doing archaeology on a legacy codebase and need to understand what an existing feature does before replacing it.
  • You need a historical reference for what a PHP-side headless-browser API should look like while designing your own abstraction over a modern runtime (the wrapper's procedure/command pattern is genuinely instructive).

Look elsewhere — decisively — when:

  • Any new development. PhantomJS is abandoned upstream; there are no security updates and no path to modern PHP compatibility. Adding it now is taking on guaranteed future work.
  • Security or compliance matters at all. An unmaintained binary executing arbitrary JS and rendering untrusted HTML in your infrastructure is a poor position to defend in a review.
  • You need modern web support. PhantomJS's WebKit predates large swathes of current CSS and JS. Pages that render correctly in a real browser will silently render wrong in your PDFs and screenshots — a class of bug that is expensive to diagnose and erodes trust in generated documents.
  • You need fonts, RTL, flexbox/grid, or web components to behave. This is where the rendering gap becomes a customer-visible defect rather than a technicality.
  • You need concurrency, sandboxing, or container-friendly deployment. Modern alternatives give you process pools, resource limits, and maintained Docker images.
  • You want a supported vendor or community. Nothing here is maintained.

Replacement shortlist worth evaluating: Browsershot (Chrome via Puppeteer, Laravel-friendly, same "render HTML, get PDF or PNG" ergonomics), Playwright for anything interaction-heavy, and a hosted rendering API if you'd rather not run Chromium yourself.

How to Pitch It (Stakeholders)

To executives: "We have a dependency on a browser engine that was discontinued in 2018. It still works today, but nobody is fixing it — including for security issues — and it can't reliably render modern web pages, which means some of our generated documents may already look wrong. Nothing is on fire, but every month we keep it is unplanned risk and unplanned cost. I'd like to schedule a contained migration to a maintained browser runtime; the work is bounded, the features are enumerable, and the replacement is well-trodden."

To engineering: "Treat jonnyw/php-phantomjs as frozen. Wrap every call site behind a single interface so the runtime is swappable, then move the implementation to Chrome headless via Browsershot (or Playwright if we need real interaction). Expect two categories of change: straightforward API translation for screenshots and PDFs, and a visual-diff pass because Chrome renders differently from the old WebKit — assume some template CSS needs touching. Budget for updating any tests that assert on exact rendered output. Don't take new features on this package in the meantime."

The one-line summary: a well-designed wrapper around a dead engine — valuable as a map of what we need our renderer to do, not as something to build on.

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.
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator
equipc/laravel-email-database-log
adedsec/nova-translated-labels
wazza/laravel-db-encryption
hokny/laravel-generator
vonsogt/backup
jengo/queues
jeremykenedy/laravel-observability
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums