To capture a webpage in PHP, use chrome-php/chrome to control headless Chrome or Chromium, then save the page’s screenshot. Guzzle is an HTTP client, not the renderer in this flow; keep it for separate HTTP requests your application needs. The distinction matters: installing Guzzle alone will not turn a webpage into a screenshot.
How the pieces fit together
The screenshot flow is: Composer installs the Chrome-control library, PHP starts a Chrome or Chromium process, the library opens a page and navigates to the URL, then the page screenshot method saves an image. The chrome-php/chrome project documents this browser-driven approach. Guzzle provides HTTP requests and configurable handlers, as described in its documentation; it can support other work in the same application, but it does not render the page in this example.
As an Amazon Associate I earn from qualifying purchases.
Prerequisites and installation
The project README lists PHP 7.4–8.5 and a Chrome/Chromium executable at version 65 or later as requirements. It says the library is tested on Linux and compatible with macOS and Windows. These are project-stated requirements, not an independent compatibility guarantee; check the README and the release you install before relying on them.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →- Install Composer if it is not already available in your project.
- From the project directory, install the browser-control library:
composer require chrome-php/chrome. - Install Chrome or Chromium for the operating system where PHP will run, and make sure the executable is available to the PHP process. If it is not on the usual path, configure the executable path using the options supported by the version of the library you installed.
Guzzle is optional for the screenshot itself. If the application separately needs Guzzle, install it with composer require guzzlehttp/guzzle; it will not replace Chrome in the capture flow.
#1 Best Overall
Runnable PHP example: capture a page and save a PNG
This example follows the library’s BrowserFactory, navigation wait, screenshot and cleanup pattern. Replace the example URL and output path as needed. The default screenshot format is PNG.
<?php
require __DIR__ . '/vendor/autoload.php';
use HeadlessChromiumBrowserFactory;
$url = 'https://example.com';
$outputPath = __DIR__ . '/screenshot.png';
$browserFactory = new BrowserFactory();
$browser = $browserFactory->createBrowser();
try {
$page = $browser->createPage();
$page->navigate($url)->waitForNavigation();
$page->screenshot()->saveToFile($outputPath);
} finally {
$browser->close();
}
printf("Saved screenshot to %s\n", $outputPath);
The call to waitForNavigation() waits for navigation to complete before the capture is requested. It does not guarantee that every website-specific asynchronous widget, image, or late-loading element has finished; for those cases, use the wait or page-interaction features documented for the library version in use.
Rank #2
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
Choose the capture area and image format
The library documents PNG by default and also supports JPEG and WebP. It distinguishes among the visible viewport, a clipped region, and the whole page. Set the viewport deliberately when the dimensions of the captured browser window affect the result. For whole-page output, the project documents using getFullPageClip with captureBeyondViewport; consult the project documentation for the exact options and method signatures of your installed release.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problems- Viewport: captures the currently visible browser area. Choose this when the screenshot should match a particular window or device-sized view.
- Clipped region: captures a selected rectangle rather than the complete viewport. Use it when only a known portion of the page matters.
- Full page: captures beyond the initial viewport to include the page’s longer content. Very long pages can produce large image files and may take more time or memory than a viewport capture.
- Format: use PNG for the documented default; JPEG or WebP may suit workflows that expect those formats. Confirm the method’s format options against the library release you have installed.
Where Guzzle belongs
Use Guzzle for ordinary HTTP work such as calling an API or retrieving a resource. A browser screenshot is different: Chrome must load and render the page, including browser-side layout and scripts, before the image can be captured. The screenshot example above therefore calls the Chrome-control library rather than making a Guzzle request.
Rank #3
Guzzle can use handlers other than cURL, including PHP’s stream wrapper, according to its FAQ. Handler choice depends on the task and installed Guzzle version. Do not assume that every handler supports the same concurrency behavior: Guzzle’s overview notes cURL is required for concurrent requests. That transport detail applies to Guzzle HTTP requests, not to Chrome’s page rendering.
Or skip the browser setup
ScreenshotNeo offers a screenshot API and MCP server for developers. Send one GET request to capture a URL; it returns an image or PDF. Cookie banners, newsletter popups and chat widgets are removed before capture, and each cleanup step can be turned off. Bot checks, blank pages, timeouts, failed loads and cache hits are not billed; response headers report the page verdict and billing status. AI agents can use its MCP tools for screenshots, page information and PDF capture.
One-call cURL example (see the ScreenshotNeo documentation for the API options):
Rank #4
- Brand: Wiley
- Set of 2 Volumes
- A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
The free plan includes 1,000 screenshots per month with no card required; paid plans start at $5 for 3,000. Learn about ScreenshotNeo, or sign up for 1,000 free screenshots a month with no card.
Troubleshooting
- Chrome or Chromium does not start: confirm the executable is installed and accessible to the PHP user. If it is installed in a nonstandard location, set the executable path using the configuration supported by your installed
chrome-php/chromerelease. - Composer reports a PHP constraint conflict: compare the PHP runtime used by Composer with the version range listed by the library release you intend to install. The project README’s stated range is PHP 7.4–8.5; check the current release requirements rather than assuming every version has the same constraints.
- The screenshot is blank or incomplete: check that navigation succeeded and that the target page does not require additional time or interaction before rendering its content. Use a documented wait strategy appropriate to the page rather than assuming navigation completion means every asynchronous element is ready.
- The image only includes the first screen: that is viewport capture behavior. Use the library’s documented full-page clip and beyond-viewport capture options if the entire document is required.
- The output file is missing or unwritable: verify that the PHP process can write to the destination directory and that the path is correct. Use an absolute path while diagnosing path and permission issues.
- Guzzle handler or concurrency expectations are wrong: treat Guzzle transport configuration separately from browser capture. Its FAQ describes stream-wrapper and other handlers; its overview says cURL is needed for concurrent requests. Verify the behavior for the Guzzle version and handler in your application.
Reliability and operating considerations
Always close the browser in a finally block so cleanup runs if navigation or screenshot saving throws an exception. In production, also decide how the application will handle browser startup failures, navigation timeouts, output-file errors and retry policy; blindly retrying a slow or blocked page can consume more resources without producing a useful image. Pin and validate the dependency version and browser executable used in deployment, since browser automation compatibility can change over time.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




