bannerify/bannerify
Composer 安装命令:
composer require bannerify/bannerify
包简介
Official PHP SDK for Bannerify API - Generate images and PDFs at scale
README 文档
README
Official PHP SDK for Bannerify - Generate images and PDFs at scale via API.
Installation
Install via Composer:
composer require bannerify/bannerify
Quick Start
<?php require 'vendor/autoload.php'; use Bannerify\Client; // Create client with your API key $client = new Client('your-api-key'); // Generate an image $result = $client->createImage('tpl_xxxxxxxxx', [ 'modifications' => [ ['name' => 'title', 'text' => 'Hello World'], ['name' => 'subtitle', 'text' => 'From PHP SDK'] ] ]); if (isset($result['result'])) { file_put_contents('output.png', $result['result']); echo "Image created successfully!"; } else { echo "Error: " . $result['error']['message']; }
Features
- 🚀 Simple, intuitive API
- 🔒 Type-safe with PHPStan support
- ⚡ Built on Guzzle for reliability
- 🎯 Result/Error pattern for explicit error handling
- 📝 Comprehensive documentation
- ✅ Well-tested
Usage
Creating Images
// Generate PNG $result = $client->createImage('tpl_xxxxxxxxx', [ 'modifications' => [ ['name' => 'title', 'text' => 'My Title'], ['name' => 'image', 'src' => 'https://example.com/image.jpg'] ] ]); // Generate WebP $result = $client->createImage('tpl_xxxxxxxxx', [ 'format' => 'webp', 'modifications' => [ ['name' => 'title', 'text' => 'My Title'] ] ]); // Generate thumbnail $result = $client->createImage('tpl_xxxxxxxxx', [ 'thumbnail' => true ]);
Creating PDFs
$result = $client->createPdf('tpl_xxxxxxxxx', [ 'modifications' => [ ['name' => 'title', 'text' => 'Invoice #123'] ] ]); if (isset($result['result'])) { file_put_contents('invoice.pdf', $result['result']); }
Generating Signed URLs
$signedUrl = $client->generateImageSignedUrl('tpl_xxxxxxxxx', [ 'modifications' => [ ['name' => 'title', 'text' => 'Dynamic Title'] ], 'format' => 'png' ]); // Use in HTML echo "<img src='{$signedUrl}' alt='Generated Image' />";
Error Handling
$result = $client->createImage('tpl_xxxxxxxxx'); if (isset($result['error'])) { $error = $result['error']; echo "Error Code: " . $error['code'] . "\n"; echo "Message: " . $error['message'] . "\n"; echo "Docs: " . $error['docs'] . "\n"; } else { file_put_contents('output.png', $result['result']); }
API Reference
Constructor
new Client(string $apiKey, array $options = [])
Options:
baseUrl(string): API base URLtimeout(float): Request timeout in seconds
createImage
createImage(string $templateId, array $options = []): array
Options:
modifications(array): Array of modificationsformat(string): 'png', 'jpeg', or 'webp'thumbnail(bool): Generate thumbnail
Returns: Array with result (string) or error (array)
createPdf
createPdf(string $templateId, array $options = []): array
createStoredImage
createStoredImage(string $templateId, array $options = []): array
generateImageSignedUrl
generateImageSignedUrl(string $templateId, array $options = []): string
Examples
Generate Multiple Images
$products = [ ['name' => 'Product A', 'price' => '$29.99'], ['name' => 'Product B', 'price' => '$39.99'], ]; foreach ($products as $i => $product) { $result = $client->createImage('tpl_product_banner', [ 'modifications' => [ ['name' => 'product_name', 'text' => $product['name']], ['name' => 'price', 'text' => $product['price']] ] ]); if (isset($result['result'])) { file_put_contents("banner_{$i}.png", $result['result']); } }
Email Campaigns
foreach ($recipients as $recipient) { $signedUrl = $client->generateImageSignedUrl('tpl_email_header', [ 'modifications' => [ ['name' => 'name', 'text' => "Hi, {$recipient['name']}!"] ] ]); // Use $signedUrl in email HTML }
Documentation
Full documentation available at https://bannerify.co/docs/sdk/php/overview
Support
- Documentation: https://bannerify.co/docs
- Issues: https://github.com/bannerify/bannerify-php/issues
- Email: support@bannerify.co
License
MIT License - see LICENSE file for details
bannerify/bannerify 适用场景与选型建议
bannerify/bannerify 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 11 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「sdk」 「pdf generation」 「image generation」 「bannerify」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 bannerify/bannerify 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bannerify/bannerify 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 bannerify/bannerify 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PSR-7 compatible library for making CRUD API endpoints
Provides TCPDF integration for Symfony
A adapter for the mPDF print library
A PDF builder using HTML or DOCX templates.
A PHP library to convert MIDI files to MusicXML, and render them as PDF or SVG.
Representacion Impresa
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-11-14