October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Browsershot

How to Capture a Website Screenshot Quickly with PHP

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

The quickest documented PHP route is Spatie Browsershot: Browsershot::url(...)->save(...) renders a page through Puppeteer and headless Chrome. It is a short PHP API, not a PHP-only runtime—you must deploy Node.js plus a Chrome or Chromium binary. Once those are available, you can capture a viewport, a full page, one element, or a clipped region and control when the page is considered ready.

Use Browsershot for the shortest PHP implementation

Browsershot is a PHP wrapper around Puppeteer, which controls headless Chrome. The basic call saves a PNG (the documented default):

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

use SpatieBrowsershotBrowsershot;

$pathToImage = __DIR__ . '/storage/example.png';
Browsershot::url('https://example.com')
    ->save($pathToImage);

Install the Browsershot version that matches your PHP application by following the v4 introduction. The capture process still needs Node.js, Puppeteer and a Chrome/Chromium executable. Confirm those prerequisites in the host or container before debugging PHP code; the Laravel Screenshot requirements also call out Node.js and Chrome/Chromium for its Browsershot driver.

A complete command-line PHP example

This script accepts a URL and output path, creates the destination directory, and returns a nonzero exit code if the file was not written:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
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
<?php
declare(strict_types=1);

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

use SpatieBrowsershotBrowsershot;

$url = $argv[1] ?? 'https://example.com';
$output = $argv[2] ?? __DIR__ . '/shots/example.png';

$directory = dirname($output);
if (!is_dir($directory) && !mkdir($directory, 0775, true) && !is_dir($directory)) {
    throw new RuntimeException("Cannot create output directory: {$directory}");
}

Browsershot::url($url)->save($output);

if (!is_file($output) || filesize($output) === 0) {
    throw new RuntimeException("Screenshot was not created: {$output}");
}

echo "Saved {$output}n";

Run it with the URL and a writable path, for example php capture.php https://example.com shots/example.png. Keep URLs and output paths under your application’s control if untrusted users can submit them.

Prepare the browser runtime before you capture

  1. Install Browsershot. Add the package through Composer and use the current v4 documentation for the PHP and package versions in your deployment.
  2. Install Node.js and Puppeteer. Browsershot delegates browser control to Puppeteer rather than rendering HTML inside PHP.
  3. Provide Chrome or Chromium. The executable must be available to the account running PHP (web server, queue worker or CLI user).
  4. Test from the same execution context. A browser that works in your shell may be unavailable to a restricted PHP-FPM or queue user because of PATH, permissions, sandbox or filesystem differences.
  5. Make the destination writable. Use an absolute path and verify the resulting file, as the example does.

There is no documented benchmark that makes one host, browser build or wait strategy universally fastest. Treat browser startup, page complexity and your server’s permissions as deployment variables.

Choose the image scope and output settings

The image creation guide documents the controls below. Pick the smallest capture that answers your use case; it reduces accidental whitespace and makes downstream processing easier.

Goal Browsershot setting What it captures
Visible viewport No extra scope option The page at the browser viewport size.
Entire document ->fullPage() A full-page image rather than only the initial viewport.
One DOM element ->select('.selector') The element matching the CSS selector.
Defined rectangle ->clip($x, $y, $width, $height) A region at the supplied coordinates and dimensions.
Fixed layout ->windowSize($width, $height) A predictable viewport in CSS pixels.

For example, a full-page capture at a fixed desktop viewport is:

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

Browsershot::url('https://example.com')
    ->windowSize(1440, 900)
    ->fullPage()
    ->save(__DIR__ . '/shots/full-page.png');

For a component, select it instead of stitching a whole document:

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
Browsershot::url('https://example.com/pricing')
    ->windowSize(1280, 800)
    ->select('#pricing-table')
    ->save(__DIR__ . '/shots/pricing.png');

JPEG is available with setScreenshotType('jpeg', $quality). The guide also documents device scale factors for higher-density output and mobile emulation when you need a phone layout. Record the viewport, emulation and format alongside generated files so a later capture can be reproduced.

Wait for the page you actually want

A screenshot taken immediately after navigation can miss JavaScript-rendered content, fonts or lazy images. Match the wait to the page’s behavior rather than adding an arbitrary delay to every URL.

Wait for network activity to settle

Browsershot::url('https://example.com/catalog')
    ->fullPage()
    ->waitUntilNetworkIdle()
    ->save(__DIR__ . '/shots/catalog.png');

Network-idle waiting can be a poor fit for pages with analytics, polling or chat requests that never stop. Browsershot documents a less strict network-idle mode; use it when continuing background traffic should not block the capture.

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

Wait for a known element

Browsershot::url('https://example.com/dashboard')
    ->waitForSelector('[data-rendered="true"]')
    ->save(__DIR__ . '/shots/dashboard.png');

This is usually more explicit than guessing how many milliseconds a page needs. The selector must be present only after the content you need is rendered.

Wait for a JavaScript condition or a fixed delay

Browsershot::url('https://example.com/report')
    ->waitForFunction('window.reportReady === true')
    ->save(__DIR__ . '/shots/report.png');

Browsershot::url('https://example.com/animation')
    ->delay(1500)
    ->save(__DIR__ . '/shots/animation.png');

A fixed delay is useful when you cannot expose a readiness signal, but it is sensitive to server and network conditions. Prefer a selector or function when you control the page.

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.

Control fidelity without making the capture fragile

  • Viewport: Set windowSize() whenever responsive breakpoints affect the result.
  • Pixel density: Set the documented device scale factor when the consumer needs a higher-density bitmap; expect the pixel dimensions and file size to change.
  • Mobile layout: Use mobile emulation for a mobile rendering rather than merely shrinking a desktop screenshot.
  • Full page versus lazy content: Full-page mode describes the document area, but lazy resources still need a trigger and an appropriate wait.
  • Element and clip captures: A selector is resilient to page position changes; fixed coordinates are useful for a known canvas but can break after layout changes.
  • Format: Keep PNG for lossless UI text and transparency needs; choose JPEG with an explicit quality when a smaller photographic file is more useful.

Do not assume that one setting works for every site. Consent dialogs, animations, endless feeds and background requests all change what “ready” means.

Alternatives when Browsershot is not a fit

Approach Where the browser runs PHP integration When to consider it
Browsershot Your Chrome/Chromium runtime High-level PHP wrapper over Puppeteer You want the shortest documented URL-to-image API and can operate Node.js plus Chrome.
chrome-php/chrome Your Chrome/Chromium runtime Direct PHP control of Chrome You need lower-level browser control and accept more runtime detail.
Playwright PHP Your browser runtime Playwright’s PHP screenshot API Your project already standardizes on Playwright and its documented API fits the capture.
Hosted screenshot API An external provider HTTP request from PHP Your host cannot install or safely operate a browser, or you prefer provider-managed capture infrastructure.

The available documentation does not establish a performance, reliability, feature or cost winner among these alternatives. Compare the browser’s location, PHP and runtime requirements, capture controls, credentials and external-data policy for your deployment.

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

Or skip the browser setup

ScreenshotNeo is a hosted website screenshot API and MCP server. One GET request returns PNG, JPEG, WebP or PDF; the service accepts and removes cookie/consent banners, newsletter popups and chat widgets before capture. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and each response identifies the page verdict and billing status in X-Page-Verdict and X-Billed headers.

Use the ScreenshotNeo API documentation for the complete parameter list. This cURL call writes the returned WebP:

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

Equivalent PHP, Python and Node.js requests are:

<?php
$ch = curl_init('https://api.screenshotneo.com/v1/shot?' . http_build_query([
    'access_key' => getenv('SCREENSHOTNEO_API_KEY'),
    'url' => 'https://stripe.com',
]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 90);
$body = curl_exec($ch);
if ($body === false) {
    throw new RuntimeException(curl_error($ch));
}
curl_close($ch);
file_put_contents(__DIR__ . '/shot.webp', $body);
import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
    timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

Its options include full-page capture with lazy images loaded, CSS-selector element capture, dark mode, 12 device presets plus custom viewports, retina scale, PDF paper and page-range controls, HTML/CSS-to-image, custom CSS and JavaScript, pre-capture clicks, hidden selectors, waits for selectors/delays/network idle, ad/tracker/request/resource blocking, headers, cookies, user agents and Authorization, timezone and geolocation, transparent backgrounds, resizing, configurable-TTL caching, signed image links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, a usage API and an OpenAPI specification. Parameter names used by other screenshot APIs also work, which can simplify a migration.

ScreenshotNeo’s MCP server exposes take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients. Every feature is on every plan. The current plans are:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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
Plan Included shots/month Price
Free 1,000 $0, no card
Starter 3,000 $5
Growth 15,000 $15
Pro 60,000 $39
Scale 250,000 $99
Business 1,000,000 $249

Yearly billing gives two months free. Keep the access key in an environment variable or secret store rather than committed PHP, Python or JavaScript source. If you want a managed browser, clean captures and agent access without installing Chrome, sign up for 1,000 free screenshots a month with no card.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot the failures that appear most often

“Chrome/Chromium executable not found”

Cause: The browser is not installed, is outside the service user’s PATH, or the process points at a different environment. Fix: Install a supported Chrome/Chromium binary, make it readable and executable by the PHP worker, and test from that worker’s account.

Node or Puppeteer errors

Cause: Node.js/Puppeteer is missing or its versions do not match the Browsershot setup. Fix: Install the documented dependencies for your Browsershot version and run the capture from the same release environment used by the application.

The image is blank or incomplete

Cause: Capture happened before JavaScript, lazy images or fonts finished. Fix: Wait for a meaningful selector or JavaScript condition; use network-idle only when the page can become idle, or use the less strict mode for pages with continuing requests.

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

A full-page image stops at the viewport

Cause: The call did not enable full-page mode, or the page’s content is loaded only after scrolling/intersection events. Fix: Add ->fullPage(), then make sure the page has loaded the lazy content before the screenshot.

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.

The capture works in CLI but fails in production

Cause: Different user permissions, PATH, sandbox rules, writable directories or network egress. Fix: Compare the CLI and PHP-FPM/queue environments and log the browser and output paths without exposing credentials.

Network-idle waiting never finishes

Cause: Analytics, polling or chat keeps a request open. Fix: Replace it with waitForSelector(), waitForFunction(), a bounded delay, or the documented less strict network-idle option.

Operational checklist

  • Pin the PHP package and browser runtime versions used in deployment.
  • Run captures as the same account and filesystem context as production workers.
  • Use absolute, writable output paths and verify file size after saving.
  • Choose a deterministic viewport, scope and wait condition for repeatable images.
  • Set a timeout around jobs and record the target URL, format and capture settings for diagnosis.
  • Do not place API keys in source control; use environment or secret configuration.
  • For external services, decide whether sending the target URL and page content to a provider fits your privacy and compliance requirements.

Frequently Asked Questions

Is a full-page screenshot the same as a long browser window?

No. Browsershot’s fullPage() option asks the browser to render the document’s full page area; a normal viewport capture contains only the visible viewport. Lazy content still needs an appropriate wait.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

Can I use a hosted API only for some URLs?

Yes. Keep local Browsershot for pages that must stay inside your infrastructure and call a hosted API for jobs your server cannot run, while applying the same credential, privacy and output-policy checks to each route.

Which wait should I choose for a page with live updates?

Prefer a page-specific readiness selector or JavaScript condition. Network-idle waits can remain open when analytics, polling or chat continuously requests data.

The Bottom Line

For a PHP application that can run Node.js and Chrome/Chromium, Browsershot is the shortest path: configure the runtime, choose the capture scope, and wait for the page’s real readiness signal. If installing that stack is the obstacle, use a documented direct browser library or a hosted service such as ScreenshotNeo.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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.

Read next

Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.