Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To capture a website screenshot with PHP, use PHP to control a real browser: install a browser-automation package and its runtime dependencies, navigate to the URL, wait for the page state your image needs, then save the screenshot to a writable file. The main choices are Playwright for PHP, chrome-php/chrome, and Spatie Browsershot. Pick based on the browser engines and runtime you can support—not an assumed speed advantage.

Choose a PHP screenshot library

All three options render the page in a browser rather than trying to turn its HTML into a picture directly. That matters for pages whose layout or content depends on JavaScript, CSS, fonts, or images. Their documented browser and runtime setups differ:

Library Browser and runtime Useful documented capabilities
Playwright for PHP PHP 8.2+ and Node.js 20+; its setup includes a browser-install command. It documents Chromium, Firefox, and WebKit. Screenshot saving and the option to launch a browser or connect to an external browser. The project describes connecting over the Playwright protocol as the recommended, more complete connection mode.
chrome-php/chrome PHP 7.4–8.5 and a Chrome/Chromium executable version 65 or later, as documented by the project on 2026-09-29. PNG, JPEG, and WebP output; clipped-region and full-page capture. The project says it is tested on Linux and compatible with macOS and Windows; check the compatibility of the version you install.
Spatie Browsershot Uses Puppeteer running headless Chrome. Can render a URL, supplied HTML, or an HTML file to an image; it can also return body HTML after JavaScript has run. Its current workflow uses Puppeteer; its older v2 Chrome CLI route is no longer maintained.

Choose Playwright if you need its documented browser-engine choices or want the option to connect to a separately managed browser. Choose chrome-php/chrome if you can provide a Chrome/Chromium executable and want its explicitly documented image formats and full-page capture. Consider Browsershot when its URL-or-HTML rendering workflow fits your application.

Requirements above are those documented by the projects and checked on 2026-09-29; they are not independent compatibility tests. Package versions and supported runtimes can change, so verify the chosen project’s installation instructions for the version you plan to use.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents

Install the package and browser dependencies

Playwright for PHP

  1. Confirm that your environment meets the project’s documented PHP 8.2+ and Node.js 20+ requirements.
  2. From the PHP project directory, install the package: composer require --dev playwright-php/playwright.
  3. Install its browsers: vendor/bin/playwright-install --browsers.
  4. Use the project’s current README and API reference to confirm the exact PHP calls for the installed version before wiring them into your application.

This is a browser automation setup, not just a Composer dependency: the browser binaries and Node.js runtime also need to be available to the process that takes the screenshot.

chrome-php/chrome

  1. Install the package with composer require chrome-php/chrome.
  2. Install or configure a Chrome/Chromium executable that meets the project’s documented requirements, and make sure the PHP process can run it.
  3. Follow the installed version’s README for its browser-launch configuration and capture options.

This route can be a practical fit if your application already manages Chrome or Chromium. A missing executable, an executable that cannot launch in your server environment, or a version mismatch can prevent capture even when Composer installation succeeds.

Spatie Browsershot

Browsershot delegates page rendering to Puppeteer and headless Chrome. Install and configure the current Browsershot, Puppeteer, and Chrome dependencies according to their project documentation. Do not start a new implementation using the older Browsershot v2 Chrome CLI route: the project identifies that route as no longer maintained.

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors

Capture a page with PHP

The basic sequence is the same whichever library you select: start or connect to the browser, create a page, navigate, wait for the state you need, take the screenshot, and save it somewhere the PHP process can write. With chrome-php/chrome, the project documents this flow using its browser factory, page navigation, navigation wait, and screenshot save methods:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
<?php

require __DIR__ . '/vendor/autoload.php';

use HeadlessChromiumBrowserFactory;

$url = 'https://example.com';
$output = __DIR__ . '/screenshot.png';

$factory = new BrowserFactory();
$browser = $factory->createBrowser();

try {
    $page = $browser->createPage();
    $page->navigate($url)->waitForNavigation();
    $page->screenshot()->saveToFile($output);
    echo "Saved screenshot to {$output}" . PHP_EOL;
} finally {
    $browser->close();
}

Install the package first with Composer. The example captures the page after navigation completes and saves the result in the script’s directory. Check that the PHP user can write there; for a web application, a dedicated writable output directory is usually easier to manage. The project also documents JPEG and WebP output and options for clipped or full-page captures; consult the installed version’s README for the exact configuration syntax.

Navigation completion is a starting point, not a guarantee that every site’s visual content is ready. A page may continue rendering after the initial navigation because it loads data, images, or other resources later. When the screenshot must include a particular element or state, wait for that content using the selected library’s supported page-wait mechanism before capturing. There is no single wait condition established by these project examples that guarantees every site is visually settled.

Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

Choose viewport, region, or full-page capture

  • Viewport: Use a normal page screenshot when you need what a user sees in the current browser window. Set the viewport to the size your application or test requires before navigation or capture, following your package’s API.
  • Clipped region: Use a clip when only a known rectangle matters—for example, a chart or a card. chrome-php/chrome documents clipped-region screenshots. If the region moves with responsive layout, make sure your viewport and page state are fixed before capturing.
  • Full page: Use the full-page option when the output must include content beyond the viewport. chrome-php/chrome documents full-page capture using a full-page clip with capture beyond the viewport enabled. Long pages can produce much taller image files than viewport shots.

For Playwright for PHP, the documentation describes screenshot saving and exposes a screenshot() API. The exact capture options available to your installed release should be checked in its API reference rather than inferred from another Playwright language binding.

Save and operate screenshots reliably

Use an intentional output path

__DIR__ . '/screenshot.png' makes the example’s output location relative to the PHP script rather than the caller’s working directory. In a deployed application, select a directory deliberately, check that it exists, and ensure the PHP worker has permission to write there. Avoid returning a success response until the screenshot file exists and the capture has completed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Close the browser and handle failures

The finally block in the example closes the browser even if navigation or saving throws an error. In production, catch and log failures at the application boundary, and return a useful error to the caller instead of treating a missing or incomplete image as a successful capture. If you reuse a browser process for multiple jobs, follow the library’s lifecycle guidance and ensure a failed page does not leave a browser process running indefinitely.

Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

Keep execution limits in mind

Browser startup, page loading, and image rendering take longer and use more resources than a simple HTTP request. A server-side request timeout that is shorter than the browser work can terminate a valid capture prematurely. Set application and worker limits to accommodate the pages you support, while also imposing a maximum duration so a stalled site does not occupy a worker forever. The package documentation cited here does not establish a universal timeout or a performance ranking among these libraries.

Troubleshooting common failures

  • Composer succeeds, but browser launch fails. The PHP package alone is not the browser. For Playwright, confirm Node.js and the installed browser binaries are available to the running process. For chrome-php/chrome, confirm the configured Chrome/Chromium executable exists and can launch under the PHP user’s permissions.
  • The page loads, but the screenshot is blank or incomplete. Navigation may have finished before client-side rendering or delayed content. Wait for the specific content your image needs, and check whether the target page requires additional time or interaction.
  • The file is missing or cannot be saved. Check the resolved output path, directory existence, and write permissions for the PHP worker. Capture exceptions rather than reporting success based only on the absence of a visible error.
  • The image cuts off content. A viewport screenshot includes only the viewport. Use the library’s documented full-page option if the whole document is required, or a clip when only a specific region is needed.
  • The package’s setup instructions do not match your installed version. Browser automation packages and APIs change. Check the current project documentation and the version actually installed by Composer; do not assume an old snippet or legacy integration remains supported.
  • The job hangs on one website. The site may be slow, waiting on external resources, or never reaching the condition your code expects. Add an application-level upper time limit, log the URL and failure stage, and use a wait tied to required content rather than an indefinite wait.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If you do not want to manage a browser runtime in your PHP application, ScreenshotNeo provides a website screenshot API. Its one-call request can return a PNG, JPEG, WebP, or PDF; the API documentation is at https://screenshotneo.com/docs/.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

ScreenshotNeo accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the page verdict and billing status in X-Page-Verdict and X-Billed headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots. Every feature is on every plan. See ScreenshotNeo or sign up free for 1,000 screenshots a month with no card.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Which approach should you use?

Use an in-process browser library when you need PHP to control the browser workflow directly and are prepared to install and operate its dependencies. Use an API when you prefer to make a request instead of provisioning browser binaries in your application. For the library route, select based on engine choice, runtime constraints, and capture options; the available project documentation does not support declaring one universally fastest.

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.

Frequently Asked Questions

Can PHP take a screenshot without a browser?

The three documented approaches here render the page with a browser: Playwright, Chrome/Chromium through chrome-php, or Puppeteer and headless Chrome through Browsershot.

Can I capture a page that requires JavaScript?

These browser-based workflows render pages in a browser, and Browsershot also documents returning body HTML after JavaScript has run. For a screenshot, wait for the page-specific content you need before capture.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.