PHPackages                             hamza-rico/laravel-pingen-letter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. hamza-rico/laravel-pingen-letter

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

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 &amp; mail API. Laravel-first.

v1.0.0(1mo ago)11MITPHPPHP ^8.2CI passing

Since Jul 15Pushed 1mo agoCompare

[ Source](https://github.com/hamza-rico/laravel-pingen-letter)[ Packagist](https://packagist.org/packages/hamza-rico/laravel-pingen-letter)[ Docs](https://github.com/hamza-rico/laravel-pingen-letter)[ RSS](/packages/hamza-rico-laravel-pingen-letter/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (8)Versions (2)Used By (0)

Laravel Pingen Letter
=====================

[](#laravel-pingen-letter)

Turn **any PDF into a Pingen-ready A4 letter** and send it through the [Pingen](https://www.pingen.com) print &amp; 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:

1. Draws an **address cover page** (recipient in the window zone).
2. **Merges** cover + your documents into one file (via a pluggable driver).
3. **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
------------

[](#requirements)

- PHP 8.2+
- Laravel 10, 11 or 12
- A [Pingen](https://www.pingen.com) account + a Developer-App (OAuth2 `client_credentials`)
- A PDF merge driver — one of:
    - **ConvertAPI** (recommended, no server binary) — `composer require convertapi/convertapi-php`
    - **Ghostscript** (`gs` installed on the server)
    - **FPDI** (pure PHP, only for simple/uncompressed inputs)

Installation
------------

[](#installation)

```
composer require hamza-rico/laravel-pingen-letter
php artisan vendor:publish --tag=pingen-letter-config
```

Configuration
-------------

[](#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=true` until you're ready to go live.

Usage
-----

[](#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)

[](#just-build-the-print-ready-pdf-no-sending)

```
$pdf = PingenLetter::to($recipient)
    ->documents([$path])
    ->build(); // ['path' => '/tmp/…​.pdf', 'pages' => 2]
```

### Low-level API access

[](#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
-----------

[](#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
-----------------

[](#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
-------

[](#testing)

```
composer install
vendor/bin/phpunit
```

License
-------

[](#license)

MIT.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance90

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

46d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/97a181c4807f860865c27cb3aae9a59e690811813b771da7253572254da5dcb3?d=identicon)[hamza-rico](/maintainers/hamza-rico)

---

Top Contributors

[![hamza-rico](https://avatars.githubusercontent.com/u/98967561?v=4)](https://github.com/hamza-rico "hamza-rico (1 commits)")

---

Tags

laravelpdfpostalmailprintdirect\_mailletterpingensnail-mail

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hamza-rico-laravel-pingen-letter/health.svg)

```
[![Health](https://phpackages.com/badges/hamza-rico-laravel-pingen-letter/health.svg)](https://phpackages.com/packages/hamza-rico-laravel-pingen-letter)
```

###  Alternatives

[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

80732.6M270](/packages/laravel-mcp)[psalm/plugin-laravel

Psalm plugin for Laravel

3365.5M359](/packages/psalm-plugin-laravel)[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k104.7M370](/packages/laravel-horizon)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45945.2k1](/packages/pressbooks-pressbooks)[spatie/laravel-export

Create a static site bundle from a Laravel app

680160.8k7](/packages/spatie-laravel-export)[api-platform/laravel

API Platform support for Laravel

58190.1k22](/packages/api-platform-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
