hqapi/hqapi-client
最新稳定版本:1.0.1
Composer 安装命令:
composer require hqapi/hqapi-client
包简介
A PHP client for the API services at HQAPI.com. Get your API token at https://hqapi.com/
README 文档
README
A lightweight and easy-to-use PHP client for interacting with the HQAPI web services.
This client provides convenient access to HQAPI endpoints for tasks such as capturing screenshots, example operations, and other web services — without manually handling HTTP requests or cURL calls.
🚀 Features
- Simple, intuitive interface for all HQAPI endpoints
- Fully type-hinted and PHP 8+ compatible
- Automatic error handling with
ApiException - Handles JSON responses and binary content (images) seamlessly
- PSR-12 compliant and ready for Composer autoloading
📦 Installation
Install via Composer:
composer require hqapi/hqapi-client
Autoloading is handled automatically by Composer.
🔧 Usage
Initialize the client
<?php use HQAPI\ScreenshotClient; use HQAPI\Exceptions\ApiException; require 'vendor/autoload.php'; $client = new ScreenshotClient('YOUR_API_TOKEN_HERE');
Screenshot Create method
try { $response = $client->create( url: "https://hqapi.com/", theme: "dark", full_page: true ); // Get raw content (image data) $imageData = $response->getContent(); // Save to disk file_put_contents("screenshot.png", $imageData); echo "Screenshot saved successfully!"; } catch (ApiException $e) { echo "API error: " . $e->getMessage(); }
ExampleClient usage
use HQAPI\ExampleClient; $example = new ExampleClient('YOUR_API_TOKEN_HERE'); try { // No operation $nop = $example->nop(); // Ping $ping = $example->ping("hello"); // Add numbers $sum = $example->add(3, 7); echo "Ping response: $ping, Sum: $sum"; } catch (ApiException $e) { echo "API error: " . $e->getMessage(); }
🛠️ Classes
- ScreenshotClient – Screenshot API methods (
nop,create) - ExampleClient – Example API methods (
nop,ping,add) - ApiException – Thrown on API errors or invalid responses
📜 License
Distributed under the MIT License.
统计信息
- 总下载量: 10
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-10-17