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 timestimeout(int): cURL timeout in seconds. Defaults to30
API Endpoints
The SDK supports two base URLs:
- CDN:
https://cdn.capture.page(default) - Edge:
https://edge.capture.page(whenuseEdgeistrue)
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 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 techulus/capture 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Extract, Transform and Load data using PHP.
A block that displays featured content - large image, title, description and link.
Library for merging source data to destination data only if destination data remains valid after that
PHP Interface for Babel Street Text Analytics
TYPO3 CMS extension to create gallery content element with preset crop ratios and pagination
Puts the Symfony Translation Component on steroids
统计信息
- 总下载量: 15
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 40
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-05