PHPackages                             techulus/capture - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. techulus/capture

ActiveLibrary[API Development](/categories/api)

techulus/capture
================

Official PHP SDK for Capture (capture.page). Capture screenshots, generate PDFs, extract content and metadata from web pages.

v1.2.0(4w ago)0151MITPHPPHP &gt;=8.1CI passing

Since Jun 7Pushed 2w agoCompare

[ Source](https://github.com/techulus/capture-php)[ Packagist](https://packagist.org/packages/techulus/capture)[ Docs](https://capture.page)[ RSS](/packages/techulus-capture/feed)WikiDiscussions main Synced 3d ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

Capture PHP SDK
===============

[](#capture-php-sdk)

Official PHP SDK for [Capture](https://capture.page) - Screenshot and content extraction API.

Installation
------------

[](#installation)

```
composer require techulus/capture
```

Quick Start
-----------

[](#quick-start)

```
use Techulus\Capture\Capture;

$client = new Capture('your-api-key', 'your-api-secret');

$imageUrl = $client->buildImageUrl('https://example.com');
echo $imageUrl;
```

Features
--------

[](#features)

- **Screenshot Capture**: Capture full-page or viewport screenshots as PNG/JPG
- **PDF Generation**: Convert web pages to PDF documents
- **Content Extraction**: Extract HTML and text content from web pages
- **Metadata Extraction**: Get page metadata (title, description, og tags, etc.)
- **Animated GIFs**: Create animated GIFs of page interactions
- **Browser Sessions**: Create stateful browser sessions and run actions
- **Zero Dependencies**: Uses only PHP built-in extensions (curl, json)

Usage
-----

[](#usage)

### Initialize the Client

[](#initialize-the-client)

```
use Techulus\Capture\Capture;

$client = new Capture('your-api-key', 'your-api-secret');

// Use edge endpoint for faster response times
$client = new Capture('your-api-key', 'your-api-secret', ['useEdge' => true]);
```

### Building URLs

[](#building-urls)

#### Image Capture

[](#image-capture)

```
$imageUrl = $client->buildImageUrl('https://example.com');

$imageUrl = $client->buildImageUrl('https://example.com', [
    'full' => true,
    'delay' => 2,
    'vw' => 1920,
    'vh' => 1080,
]);
```

#### PDF Capture

[](#pdf-capture)

```
$pdfUrl = $client->buildPdfUrl('https://example.com');

$pdfUrl = $client->buildPdfUrl('https://example.com', [
    'format' => 'A4',
    'landscape' => true,
]);
```

#### Content Extraction

[](#content-extraction)

```
$contentUrl = $client->buildContentUrl('https://example.com');
```

#### Metadata Extraction

[](#metadata-extraction)

```
$metadataUrl = $client->buildMetadataUrl('https://example.com');
```

#### Animated GIF

[](#animated-gif)

```
$animatedUrl = $client->buildAnimatedUrl('https://example.com');
```

### Fetching Data

[](#fetching-data)

#### Fetch Image

[](#fetch-image)

```
$imageData = $client->fetchImage('https://example.com');
file_put_contents('screenshot.png', $imageData);
```

#### Fetch PDF

[](#fetch-pdf)

```
$pdfData = $client->fetchPdf('https://example.com', ['full' => true]);
file_put_contents('page.pdf', $pdfData);
```

#### Fetch Content

[](#fetch-content)

```
$content = $client->fetchContent('https://example.com');
echo $content['html'];
echo $content['textContent'];
echo $content['markdown'];
```

#### Fetch Metadata

[](#fetch-metadata)

```
$metadata = $client->fetchMetadata('https://example.com');
print_r($metadata['metadata']);
```

#### Fetch Animated GIF

[](#fetch-animated-gif)

```
$gifData = $client->fetchAnimated('https://example.com');
file_put_contents('animation.gif', $gifData);
```

### Browser Sessions

[](#browser-sessions)

```
$session = $client->sessions()->create(['maxTtlSeconds' => 300]);
$sessionId = $session['session']['id'];

$client->sessions()->action($sessionId, 'goto', ['url' => 'https://example.com']);
$screenshot = $client->sessions()->action($sessionId, 'screenshot', ['fullPage' => true]);

$client->sessions()->close($sessionId);
```

### CDP Sessions

[](#cdp-sessions)

To create a session with a Chrome DevTools Protocol (CDP) connection, pass `['cdp' => true]` when creating the browser session. The response includes a connection URL on the returned session object:

```
$created = $client->sessions()->create([
    'maxTtlSeconds' => 300,
    'cdp' => true,
]);

$session = $created['session'];
$connectUrl = $session['connectUrl'];

echo $connectUrl;

$client->sessions()->close($session['id']);
```

CDP sessions cannot be combined with `proxy` or `bypassBotDetection` options.

Configuration Options
---------------------

[](#configuration-options)

### Constructor Options

[](#constructor-options)

- `useEdge` (bool): Use edge.capture.page instead of cdn.capture.page for faster response times
- `timeout` (int): cURL timeout in seconds. Defaults to `30`

API Endpoints
-------------

[](#api-endpoints)

The SDK supports two base URLs:

- **CDN**: `https://cdn.capture.page` (default)
- **Edge**: `https://edge.capture.page` (when `useEdge` is `true`)

License
-------

[](#license)

MIT

Links
-----

[](#links)

- [Website](https://capture.page)
- [Documentation](https://docs.capture.page)
- [GitHub](https://github.com/techulus/capture-php)

Support
-------

[](#support)

For support, please visit [capture.page](https://capture.page) or open an issue on GitHub.

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance96

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

28d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7f99affda55e9eb0bcc30b2099b0cfc66292a0573292ecca142f6a16ecb9aca1?d=identicon)[arjunkomath](/maintainers/arjunkomath)

---

Top Contributors

[![arjunkomath](https://avatars.githubusercontent.com/u/2555067?v=4)](https://github.com/arjunkomath "arjunkomath (4 commits)")[![techulus-agent](https://avatars.githubusercontent.com/u/291950465?v=4)](https://github.com/techulus-agent "techulus-agent (1 commits)")

---

Tags

apiheadless-browsersheadless-chromephprest-apiscreenshotpdfscreenshotcaptureweb-scraping content extraction

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/techulus-capture/health.svg)

```
[![Health](https://phpackages.com/badges/techulus-capture/health.svg)](https://phpackages.com/packages/techulus-capture)
```

###  Alternatives

[pdfcrowd/pdfcrowd

A client library for the Pdfcrowd API. It lets you convert between HTML, PDF and various image formats

621.2M1](/packages/pdfcrowd-pdfcrowd)[docraptor/docraptor

A native client library for the DocRaptor HTML to PDF/XLS service.

241.9M8](/packages/docraptor-docraptor)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
