A PHP library to control headless Chrome/Chromium instances for browser automation, screenshots, and PDF generation.
Chrome PHP is a PHP library that allows developers to programmatically control headless Chrome or Chromium browsers. It solves the problem of automating web interactions, capturing screenshots, generating PDFs, and extracting data from websites directly from PHP scripts, eliminating the need for external browser automation tools.
PHP developers who need to automate browser tasks such as web scraping, automated testing, server-side rendering, or generating documents from web pages.
Developers choose Chrome PHP for its straightforward PHP-native API, support for both synchronous and asynchronous operations, and comprehensive feature set that covers everything from basic navigation to advanced DOM manipulation and emulation, all without requiring external dependencies beyond Chrome.
Instrument headless chrome/chromium instances from PHP
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
The API mirrors natural browser interactions, such as using methods like `navigate()` and `screenshot()`, making it straightforward for developers to automate web tasks without deep protocol knowledge, as shown in the README examples.
Supports a wide range of functionalities including screenshots, PDF generation, JavaScript evaluation, and DOM manipulation, with detailed examples for mouse and keyboard emulation in the README.
Allows both blocking and non-blocking operations, providing flexibility for different use cases, from simple scripts to complex asynchronous workflows, as highlighted in the library's description.
Enables sharing a single Chrome instance across multiple scripts using the `keepAlive` option and socket connections, which can improve performance and reduce overhead in repetitive tasks, demonstrated in the persistent browser example.
Requires a Chrome or Chromium executable to be installed and accessible, which complicates deployment in serverless or containerized environments where installing browsers is non-trivial.
The README explicitly states that proxy server usage with credentials does not work, limiting its use in corporate networks that require authenticated proxies.
Spawning headless Chrome instances consumes significant memory and CPU, making it less suitable for low-resource environments or high-scale applications without careful management.