Use PHP’s chrome-php/chrome Composer package to control a Chrome or Chromium browser installed on your Linux server. The essential sequence is launch the browser, open the page, wait for the relevant content, capture it, and close the browser in a finally block. The package documentation states support for PHP 7.4–8.5 and Chrome or Chromium 65+, but check the requirements for the specific package release you deploy. Project documentation
How the PHP screenshot method works
PHP does not render a modern website by itself. The server needs a browser engine, typically Chrome or Chromium, and PHP needs a way to control it. chrome-php/chrome provides that control through Chrome’s browser automation interface. You install the PHP library with Composer and install a compatible browser executable on the Linux host.
This is a good fit when your PHP application or a PHP worker should create screenshots on the same Linux system. It can capture a browser viewport, a full page, or a clipped region. A screenshot records the page’s visual state at one moment; it does not, by itself, prove which interactions produced that state.
Install Composer package and Chrome or Chromium
-
Install a compatible Chrome or Chromium executable on the Linux server. The PHP package needs the executable in addition to the Composer dependency.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsSpecial offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
-
From your PHP project directory, install the library:
composer require chrome-php/chrome -
Confirm the executable is discoverable. The library checks
CHROME_PATHand otherwise attempts to find Chrome or use the commandchrome. Linux distributions may install Chromium under a different executable name or path, so configure the path explicitly if automatic discovery does not match your installation. -
Check the requirements for the particular package version you selected. The project documentation states PHP 7.4–8.5 and Chrome/Chromium 65+; these are project-stated compatibility requirements, not a guarantee for every future release.
Capture and save a basic screenshot
This PHP example opens a URL, waits for navigation, saves a PNG, and closes the browser even if navigation or capture throws an error:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
<?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();
}
Change $url to the page you are allowed to capture and $outputPath to a location writable by the PHP process. After a successful run, the file at that path contains the screenshot. If the target is an application with client-side rendering, navigation completion may happen before its meaningful content appears; use an application-specific readiness condition instead of assuming that the first navigation event means the page is visually complete.
Choose viewport, full-page, or clipped capture
Viewport screenshot
The basic call captures what is visible in the browser viewport. This is appropriate when the screenshot should reflect a user’s current screen rather than the entire document. Set the viewport dimensions before capturing if the output must use a known layout.
Full-page screenshot
For content below the fold, the library documents full-page capture using a full-page clip and captureBeyondViewport. The following is the documented pattern; run it after the page is ready:
$page->screenshot([
'clip' => $page->getFullPageClip(),
'captureBeyondViewport' => true,
])->saveToFile(__DIR__ . '/full-page.png');
Very long pages can produce large images and may take longer to render and save. If the whole page is not necessary, capture only the relevant viewport or region.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
Rectangular clip or one element
The screenshot API supports a rectangular clipped region. Use a clip when you know the portion of the viewport you need; use an element-oriented capture when the output should isolate a component. Confirm the target element is present and in its intended state before taking the shot.
Wait for the state you actually need
waitForNavigation() is a useful baseline, but it does not establish that every client-side request, image, animation, or personalized component has finished. Decide what “ready” means for the page and wait for that condition, such as the visibility of a heading or component that matters to the screenshot. The Playwright PHP screenshot guide likewise recommends making the desired state explicit and checking a meaningful condition rather than treating the screenshot alone as proof of normal behavior. Playwright PHP screenshot guide
-
For a server-rendered page, navigation completion may be enough if the needed content is already present.
-
For a client-rendered page, wait for a page-specific element or other state that confirms the content has appeared.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy. -
For visual comparisons, keep the viewport, fonts, animations, data, browser version, and rendering environment controlled. Otherwise, differences may reflect the setup rather than a change in the page.
-
If you need to demonstrate a sequence of user actions, preserve a trace or another interaction record too. A screenshot shows the final visual state, not how the browser reached it.
Set format, dimensions, and browser options
The package documentation supports PNG, JPEG, and WebP output; PNG is the default. The quality option applies to JPEG or WebP rather than PNG. Choose a format based on the receiving system and whether smaller files or lossless output matter. The library also documents viewport sizing, headless mode, startup and communication timeouts, proxy configuration, and browser window sizing. Consult the package documentation for the option names and behavior for your installed version before adding them to a production capture flow. chrome-php/chrome documentation
The project also documents a persistent-browser pattern that reuses one browser process across scripts, as well as synchronous and asynchronous use. Reuse may suit a worker that performs repeated captures, but the documentation reviewed does not establish a throughput or resource-use advantage. Measure your own workload before choosing a process lifecycle strategy.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Alternatives: Playwright PHP and Puppeteer
If you are deciding between browser automation approaches rather than choosing an API service, the main distinction is runtime integration:
| Approach | Where it fits | Documented prerequisites or scope |
|---|---|---|
|
|
Direct PHP control of a Chrome or Chromium executable on the Linux host. |
Project documentation states PHP 7.4–8.5 and Chrome/Chromium 65+; verify the selected release requirements. Supports viewport, clipped, and full-page screenshots. |
|
Playwright PHP |
A possible fit if your team already uses Playwright’s PHP API. Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
|
The examples page search result states PHP 8.2+ and Node.js 20+ prerequisites and shows installing the Composer package and Chromium. Check the current project documentation for the release you use. Screenshot guide · Examples and installation |
|
Puppeteer |
Useful when a separate Node.js worker or service is acceptable; it is not a direct PHP package. |
Chrome describes Puppeteer as a Node library for browser control, and its API documents file output, full-page capture, clipping, formats, and quality options. Chrome Puppeteer overview · Screenshot options |
The cited documentation does not provide measured throughput, resource use, or reliability comparisons among these choices, so there is no evidence-based performance ranking here.
Recommended Free Tools
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Deployment, reliability, and security considerations
-
Browser installation: Deploy the executable as well as the PHP package, and verify which path the service account can run. A package install alone cannot render a page.
-
Readiness and timeouts: Pick wait conditions that match the target site. The library documents navigation events and timeouts; dynamic pages may require a condition tied to the content you need.
-
Sandbox configuration: The package exposes a
noSandboxoption and labels it useful in a Docker container. That description is not a complete production security policy, nor a general recommendation for visiting arbitrary URLs. Evaluate the browser’s isolation and the URLs your service accepts before deployment. -
Writable output: Save to a directory accessible to the PHP process and to the code or person that consumes the artifact. In CI, ensure the output path is one that the job uploads.
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 →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy. -
Sensitive data: Screenshots may expose credentials, account details, personal information, or internal systems rendered in a page. Restrict access and retention, and avoid capturing secrets unless the workflow requires it.
Troubleshooting common failures
Chrome or Chromium cannot be found
Cause: The browser is missing, is not on the service user’s path, or uses a distribution-specific executable name. Fix: Install Chrome or Chromium and configure the executable location using CHROME_PATH or the explicit executable setting supported by the factory. Test under the same Linux account that runs PHP.
Navigation times out or the screenshot is blank
Cause: The page may be slow, blocked, or still rendering client-side content after navigation. Fix: Review the navigation and communication timeout configuration, then wait for a meaningful page-specific condition before capturing. A timeout adjustment alone does not guarantee the required content loaded.
Output file is missing or cannot be written
Cause: The output directory may not exist or may not be writable by the PHP worker. Fix: Use an absolute or project-relative path that exists, check permissions for the process account, and confirm your CI workflow collects that path if applicable.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Full-page output is cut off
Cause: A normal viewport capture was used, or the full-page settings were not applied. Fix: Use getFullPageClip() together with captureBeyondViewport => true as shown above.
The result changes between runs
Cause: Dynamic data, animations, fonts, viewport differences, or browser/rendering versions can alter the image. Fix: Make the content state explicit and control those inputs when the screenshot is intended for visual comparison.
Or skip the browser setup
If you would rather not install and manage a browser process on your Linux PHP server, ScreenshotNeo is a website screenshot API and MCP server. One GET request can return a PNG, JPEG, WebP, or PDF. Its clean-shot flow accepts cookie or consent banners as a visitor and removes 60+ known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. AI agents can use its MCP server tools, including take_screenshot, get_page_info, and capture_pdf. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000.
For example, make the request from a PHP application with cURL:
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →<?php
$url = 'https://example.com';
$apiKey = getenv('SCREENSHOTNEO_API_KEY');
$query = http_build_query([
'access_key' => $apiKey,
'url' => $url,
]);
$ch = curl_init('https://api.screenshotneo.com/v1/shot?' . $query);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 90,
]);
$image = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error = curl_error($ch);
curl_close($ch);
if ($image === false || $status < 200 || $status >= 300) {
throw new RuntimeException('Screenshot request failed: ' . $error);
}
file_put_contents(__DIR__ . '/shot.webp', $image);
See the ScreenshotNeo API documentation for request options and response details. Start with 1,000 free screenshots per month with no card.
Frequently Asked Questions
Does the screenshot package install Chrome for me?
No. Install a Chrome or Chromium executable on the Linux host separately; the Composer package controls that browser.
Can I use the PHP method for PDFs too?
The chrome-php/chrome project documents PDF output as well as screenshots; consult its documentation for the PDF-specific call and options.
Can a screenshot prove that a workflow completed correctly?
Not on its own. It records a visual state, so retain a trace or other interaction record when the path to that state matters.
Free tools Windows power users keep installed
One-click scans. No signup required.
Quick Recap
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.

