myerscode / beacon
A fluent PHP wrapper for web page content retrieval, screenshots, PDFs, Lighthouse audits, and concurrent site crawling using Chrome.
dev-main
2026-03-31 18:55 UTC
Requires
- php: ^8.5
- dbrekelmans/bdi: ^1.4
- symfony/panther: ^2.4
Requires (Dev)
- laravel/pint: ^1.29
- phpstan/phpstan: ^2.0
- phpunit/phpunit: ^13.0
This package is auto-updated.
Last update: 2026-04-03 07:16:51 UTC
README
Beacon
A fluent PHP wrapper around Symfony Panther for web page content retrieval and site analysis. Renders JavaScript-heavy pages (SPAs, React, Vue, etc.) and provides an easy API for source code, screenshots, PDFs, meta tags, link extraction, Lighthouse audits, and concurrent site crawling.
Requirements
- PHP 8.5+
- Chrome/Chromium browser installed
- Node.js 16+ and Lighthouse CLI (only required for Lighthouse features)
Installation
composer require myerscode/beacon
ChromeDriver is installed automatically via dbrekelmans/bdi on composer install.
Quick Start
// Get the fully rendered HTML of any page $html = beacon()->visit('https://example.com')->source(); // Take a screenshot or save as PDF beacon()->visit('https://example.com')->screenshot('/tmp/shot.png'); beacon()->visit('https://example.com')->pdf('/tmp/page.pdf'); // Page info $title = beacon()->visit('https://example.com')->title(); $status = beacon()->visit('https://example.com')->statusCode(); $links = beacon()->visit('https://example.com')->links(); $meta = beacon()->visit('https://example.com')->meta(); // Lighthouse audit $scores = beacon()->visit('https://example.com')->lighthouse(); // Crawl the site for broken links $results = beacon()->visit('https://example.com')->crawl(); $broken = $results->broken();
Documentation
- Page — content, screenshots, PDF, links, meta, status code
- Lighthouse — category scores, individual audits, configuration, reports
- Crawler — concurrent spider crawl, broken link detection, retries, throttling
- Advanced Usage — browser configuration, dependency checking
License
MIT