hamza-rico/laravel-pingen-letter
Composer 安装命令:
composer require hamza-rico/laravel-pingen-letter
包简介
Turn any PDF into a Pingen-ready A4 letter (generated address cover page + A4 normalisation + safe margins) and send it through the Pingen print & mail API. Laravel-first.
README 文档
README
Turn any PDF into a Pingen-ready A4 letter and send it through the Pingen print & mail API — with a generated address cover page, automatic A4 normalisation, and safe print margins.
Pingen reads the recipient address off the first page of the PDF (the window-envelope zone) and rejects non-A4 pages or content in the protected border/postage areas. This package handles all of that for you:
- Draws an address cover page (recipient in the window zone).
- Merges cover + your documents into one file (via a pluggable driver).
- Re-lays every page to A4 with safe margins — Letter, legal, or compressed source PDFs all come out clean.
Then it uploads, creates and sends the letter via Pingen.
Requirements
- PHP 8.2+
- Laravel 10, 11 or 12
- A Pingen account + a Developer-App (OAuth2
client_credentials) - A PDF merge driver — one of:
- ConvertAPI (recommended, no server binary) —
composer require convertapi/convertapi-php - Ghostscript (
gsinstalled on the server) - FPDI (pure PHP, only for simple/uncompressed inputs)
- ConvertAPI (recommended, no server binary) —
Installation
composer require hamza-rico/laravel-pingen-letter php artisan vendor:publish --tag=pingen-letter-config
Configuration
Add to your .env:
PINGEN_STAGING=true PINGEN_CLIENT_ID=your-client-id PINGEN_CLIENT_SECRET=your-client-secret PINGEN_ORGANISATION_ID=your-organisation-uuid # merge driver: convertapi | ghostscript | fpdi PINGEN_MERGER=convertapi CONVERTAPI_SECRET=your-convertapi-secret # or, for ghostscript: # PINGEN_MERGER=ghostscript # PINGEN_GS_BIN=/usr/bin/gs
Pingen offers a free staging environment that mails nothing — keep
PINGEN_STAGING=trueuntil you're ready to go live.
Usage
use HamzaRico\PingenLetter\Facades\PingenLetter; use HamzaRico\PingenLetter\DTO\Recipient; use HamzaRico\PingenLetter\Enums\DeliveryProduct; $letter = PingenLetter::to(new Recipient( name: 'Jane Doe', street: 'Musterstrasse 12', zip: '10115', city: 'Berlin', country: 'DE', )) ->documents([ 'https://example.com/translation.pdf', storage_path('app/certificate.pdf'), ]) ->deliveryProduct(DeliveryProduct::Cheap) ->color() ->duplex() ->send(); // ['id' => '…', 'url' => 'https://app.pingen.com/…', 'status' => 'sent', 'pages' => 3]
Just build the print-ready PDF (no sending)
$pdf = PingenLetter::to($recipient) ->documents([$path]) ->build(); // ['path' => '/tmp/….pdf', 'pages' => 2]
Low-level API access
$client = PingenLetter::client(); $client->getLetter($id); // status + tracking $client->cancelLetter($id); // cancel (only while submitted / print preparation) $client->calculatePrice([...]); // price for a country + options
Page limits
Pingen enforces per-country page limits — tightest are Netherlands (14) and
India (16); most others allow 120–500. Check the page count from build()
before sending if you mail to those countries.
Delivery products
cheap (default), fast, bulk, premium, registered. Pingen maps these to
each destination country's real postal product. Only registered provides a
carrier tracking number; standard letters give status updates only.
Testing
composer install vendor/bin/phpunit
License
MIT.
hamza-rico/laravel-pingen-letter 适用场景与选型建议
hamza-rico/laravel-pingen-letter 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 07 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「mail」 「pdf」 「laravel」 「print」 「postal」 「letter」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 hamza-rico/laravel-pingen-letter 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hamza-rico/laravel-pingen-letter 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 hamza-rico/laravel-pingen-letter 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Courier offers a convenient and painless solution for creating emails tailored for your Kirby website.
Mail libraries used by Zimbra Api
Email+ extends Kirby's email capabilities by adding support for multiple email services using the same Kirby email API.
Provides TCPDF integration for Symfony
Laravel IMAP client
Alfabank REST API integration
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-15