chrome-php/chrome
Control headless Chrome from PHP. chrome-php/chrome launches Chromium/Chrome, lets you navigate pages, evaluate JavaScript, take screenshots/PDFs, intercept network events, and automate workflows via the DevTools protocol—ideal for scraping, testing, and rendering.
Server-Side Rendering (SSR) & Headless Generation: Enable dynamic PDF/screenshot generation for invoices, reports, or marketing assets without relying on frontend frameworks (e.g., replace Node.js-based SSR tools like Puppeteer with a PHP-native solution). Roadmap tie: Accelerate migration from monolithic PHP apps to microservices by offloading rendering to dedicated headless services.
Web Scraping & Data Extraction:
Replace fragile cURL-based scrapers or third-party APIs (e.g., Scrapy) with a maintainable, PHP-native tool for crawling SPAs or JavaScript-heavy sites (e.g., e-commerce product pages, real-time dashboards).
Build vs. buy: Avoid reinventing wheel for CDP integration; leverage this package to reduce dev time by 60%+.
Automated Testing: Integrate with PHPUnit or Pest to spin up real browsers for end-to-end (E2E) testing of legacy PHP apps (e.g., WordPress plugins, Laravel admin panels). Use case: Test critical user flows (e.g., checkout, form submissions) in CI/CD pipelines without flaky virtual displays.
Legacy System Modernization:
Bypass outdated tools like wkhtmltopdf or Selenium bindings for PHP. Example: Generate dynamic PDFs for legacy ERP systems without frontend refactors.
Opportunity: Reduce cloud costs by running headless Chrome in-house instead of SaaS scraping services.
A/B Testing & Canary Releases: Capture and compare screenshots of different page variants (e.g., UI tweaks) programmatically, feeding results into analytics tools like Google Optimize or custom dashboards.
Adopt when:
cURL or DOMDocument can’t handle.Look elsewhere if:
html2canvas for simple screenshots.device-mode flags or consider dedicated mobile automation tools.For Executives: "This package lets us automate Chrome/Chromium directly from PHP—enabling cost-effective solutions for PDF generation, web scraping, and testing without vendor lock-in. For example:
For Engineering: "This is a drop-in PHP library for Chrome DevTools Protocol (CDP) automation—think Puppeteer but native to PHP. Key advantages:
wkhtmltopdf hacks.chrome://flags for advanced use cases. Docs are solid but expect some CDP learning curve for complex interactions."How can I help you explore Laravel packages today?