PHPackages                             baidouabdellah/laravel-arpdf - 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. [PDF &amp; Document Generation](/categories/documents)
4. /
5. baidouabdellah/laravel-arpdf

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

baidouabdellah/laravel-arpdf
============================

Generate Arabic-friendly PDFs in Laravel with a driver-based architecture (mPDF by default)

3.0.0(2mo ago)6341↓33.3%4MITPHPPHP ^8.0

Since Oct 20Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/baidou5/laravel-arpdf)[ Packagist](https://packagist.org/packages/baidouabdellah/laravel-arpdf)[ RSS](/packages/baidouabdellah-laravel-arpdf/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (7)Versions (6)Used By (0)

[![ArPDF Logo](https://raw.githubusercontent.com/baidou5/laravel-arpdf/main/arpdf.jpg)](https://raw.githubusercontent.com/baidou5/laravel-arpdf/main/arpdf.jpg)

Laravel ArPDF
=============

[](#laravel-arpdf)

Arabic-first PDF generation for Laravel, rebuilt from scratch on top of **mPDF**.

`laravel-arpdf` is designed for production-grade Arabic documents (invoices, contracts, reports) with stable RTL rendering, Arabic shaping, and robust font handling.

Why This Is Stronger Than Dompdf
--------------------------------

[](#why-this-is-stronger-than-dompdf)

- Native mPDF engine focused on complex scripts (Arabic/RTL)
- Better Arabic glyph shaping and bidirectional text handling
- Reliable custom font loading and fallback strategy
- Rich PDF controls: metadata, margins, header/footer, watermark

Core Features
-------------

[](#core-features)

- Full Arabic + RTL + UTF-8 support
- Fluent Laravel API
- Custom Arabic fonts via config map
- `stream`, `download`, `save`, and raw `string` output
- Header / footer HTML
- Text or image watermark
- Metadata API (`title`, `author`, `subject`, `keywords`, `creator`)
- Reusable document profiles (`profile('invoice_ar')`)
- Named templates with variable interpolation
- Layouts and reusable components for templates
- Report Builder DSL for business reports
- File queue pipeline for deferred rendering
- Laravel queue pipeline (`dispatch` / `dispatchSync`)
- Plugin API (before/after render hooks)
- Plugin marketplace with named built-ins (`watermark_text`, `signature_block`, `quick_qr`, `certificate_signature`)
- Snapshot testing workflow for PDF regression checks
- PDF render cache for repeated documents

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

[](#installation)

```
composer require baidouabdellah/laravel-arpdf
```

Publish config and fonts (optional but recommended):

```
php artisan vendor:publish --provider="Baidouabdellah\LaravelArpdf\ArPDFServiceProvider"
```

Quick Example
-------------

[](#quick-example)

```
use ArPDF;

public function invoice()
{
    return ArPDF::direction('rtl')
        ->title('فاتورة')
        ->author('My Company')
        ->header('رأس الصفحة')
        ->footer('{PAGENO}')
        ->watermarkText('سري')
        ->loadView('pdf.invoice', ['title' => 'فاتورة'])
        ->download('invoice.pdf');
}
```

Production Features
-------------------

[](#production-features)

```
ArPDF::profile('invoice_ar')
    ->registerTemplate('invoice_basic', '{{ title }}{{ customer.name }}')
    ->loadTemplate('invoice_basic', [
        'title' => 'فاتورة',
        'customer' => ['name' => 'أحمد'],
    ])
    ->useCache(true, 3600)
    ->download('invoice.pdf');
```

Layouts, Components, Reports, Queue
-----------------------------------

[](#layouts-components-reports-queue)

```
$pdf = app(\Baidouabdellah\LaravelArpdf\ArPDF::class);

$pdf->registerLayout('base', '{{ section:header }}{{ content }}{{ component:footer }}')
    ->registerComponent('footer', '{{ company }}')
    ->registerTemplate('invoice', \"@layout('base')\\n@section('header'){{ title }}@endsection\\n{{ customer.name }}\")
    ->loadTemplate('invoice', [
        'title' => 'فاتورة',
        'customer' => ['name' => 'أحمد'],
        'components' => ['footer' => ['company' => 'My Co']],
    ]);

$pdf->report(function ($r) {
    $r->heading('تقرير شهري')->table(['البند', 'القيمة'], [['المبيعات', 15000]]);
});

$pipeline = $pdf->queuePipeline(); // file-based queue
$jobId = $pipeline->enqueue($pdf, storage_path('app/reports/monthly.pdf'));
$pipeline->processNext();

$pdf->laravelQueuePipeline()->dispatchSync($pdf, storage_path('app/reports/sync.pdf'));
```

Plugins &amp; Snapshots
-----------------------

[](#plugins--snapshots)

```
use Baidouabdellah\LaravelArpdf\Contracts\PdfPlugin;

class FooterPlugin implements PdfPlugin {
    public function beforeRender($pdf, string $html, array $options): array {
        return ['html' => $html . 'Signed', 'options' => $options];
    }
    public function afterRender($pdf, string $binary, array $context): string {
        return $binary;
    }
}

$pdf->usePlugin(new FooterPlugin())->loadHTML('Doc');

$pdf->usePluginNamed('watermark_text', ['text' => 'CONFIDENTIAL', 'alpha' => 0.15])
    ->usePluginNamed('signature_block', ['signer' => 'Admin', 'title' => 'CTO'])
    ->usePluginNamed('quick_qr', ['text' => 'INV-1001', 'size' => 90]) // offline QR
    ->loadHTML('Invoice');

$pdf->usePluginNamed('certificate_signature', [
    'private_key' => storage_path('keys/private.pem'),
    'certificate' => storage_path('keys/cert.pem'),
    'sidecar_path' => storage_path('app/signatures/invoice.sig.json'),
]);

$check = \Baidouabdellah\LaravelArpdf\ArPDF::verifySignature(
    storage_path('app/invoices/invoice.pdf'),
    storage_path('app/signatures/invoice.sig.json'),
    storage_path('keys/cert.pem')
);

// Artisan command
// php artisan arpdf:verify-signature storage/app/invoices/invoice.pdf storage/app/signatures/invoice.sig.json --cert=storage/keys/cert.pem

$result = $pdf->assertSnapshot('doc-v1'); // stores/compares sha256 snapshot
if (! $result['matched']) {
    // regression detected
}
```

Output Destinations
-------------------

[](#output-destinations)

`output($filename, $dest)` supports:

- Legacy: `I`, `D`, `F`, `S`
- Named: `inline`, `download`, `file`, `string`

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

[](#configuration)

Main options in `config/arpdf.php`:

- `direction`, `default_font`, `fonts_path`, `fonts`
- `paper`, `orientation`, `margins`
- `metadata`
- `mpdf` (native mPDF overrides)

Testing
-------

[](#testing)

```
vendor/bin/phpunit -c tests/phpunit.xml
```

License
-------

[](#license)

MIT

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance86

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.8% 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

Every ~125 days

Total

5

Last Release

68d ago

Major Versions

v1.3.0 → 3.0.02026-03-06

### Community

Maintainers

![](https://www.gravatar.com/avatar/2147eb2fca7ab5f0124d0fafd88ba2d2a5dfa3a0036fb8872d1084b7cba29366?d=identicon)[fadymondy](/maintainers/fadymondy)

![](https://www.gravatar.com/avatar/216f792e1285980ea75f9060eeacae300b6bba5061c0cd45e10b5f49491411ff?d=identicon)[baidou](/maintainers/baidou)

---

Top Contributors

[![baidou5](https://avatars.githubusercontent.com/u/72502903?v=4)](https://github.com/baidou5 "baidou5 (45 commits)")[![fadymondy](https://avatars.githubusercontent.com/u/11937812?v=4)](https://github.com/fadymondy "fadymondy (1 commits)")

---

Tags

arabic-languagelaravel-packagepackagepdf-documentpdf-generation

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/baidouabdellah-laravel-arpdf/health.svg)

```
[![Health](https://phpackages.com/badges/baidouabdellah-laravel-arpdf/health.svg)](https://phpackages.com/packages/baidouabdellah-laravel-arpdf)
```

###  Alternatives

[maatwebsite/excel

Supercharged Excel exports and imports in Laravel

12.7k144.3M712](/packages/maatwebsite-excel)[barryvdh/laravel-dompdf

A DOMPDF Wrapper for Laravel

7.3k87.6M278](/packages/barryvdh-laravel-dompdf)[barryvdh/laravel-snappy

Snappy PDF/Image for Laravel

2.8k24.8M48](/packages/barryvdh-laravel-snappy)[elibyy/tcpdf-laravel

tcpdf support for Laravel 6, 7, 8, 9, 10, 11

3542.7M5](/packages/elibyy-tcpdf-laravel)[lukasss93/laravel-larex

Translate your Laravel application from a single CSV file!

9790.3k2](/packages/lukasss93-laravel-larex)[ismaelw/laratex

A package for creating PDFs in Laravel using LaTeX

12730.1k](/packages/ismaelw-laratex)

PHPackages © 2026

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