定制 techulus/capture 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

techulus/capture

Composer 安装命令:

composer require techulus/capture

包简介

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

README 文档

README

Official PHP SDK for Capture - Screenshot and content extraction API.

Installation

composer require techulus/capture

Quick Start

use Techulus\Capture\Capture;

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

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

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

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

Image Capture

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

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

PDF Capture

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

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

Content Extraction

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

Metadata Extraction

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

Animated GIF

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

Fetching Data

Fetch Image

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

Fetch PDF

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

Fetch Content

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

Fetch Metadata

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

Fetch Animated GIF

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

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

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

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

The SDK supports two base URLs:

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

License

MIT

Links

Support

For support, please visit capture.page or open an issue on GitHub.

techulus/capture 适用场景与选型建议

techulus/capture 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 15 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 05 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「pdf」 「content extraction」 「screenshot」 「capture」 「web scraping」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 techulus/capture 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 techulus/capture 我们能提供哪些服务?
定制开发 / 二次开发

基于 techulus/capture 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 15
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 40
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-05