PHPackages                             ab-alselwi/laravel-arabic-html - 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. [Templating &amp; Views](/categories/templating)
4. /
5. ab-alselwi/laravel-arabic-html

ActiveLibrary[Templating &amp; Views](/categories/templating)

ab-alselwi/laravel-arabic-html
==============================

Convert laravel view to arabic html (pdf) by using ArPHP and dompdf with arabic fonts and text.

0.2.0(2y ago)3528.7k↓28.3%24[1 issues](https://github.com/Ab-Alselwi/laravel-arabic-html/issues)[3 PRs](https://github.com/Ab-Alselwi/laravel-arabic-html/pulls)MITPHPPHP ^7.3||^8.0

Since Jun 13Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Ab-Alselwi/laravel-arabic-html)[ Packagist](https://packagist.org/packages/ab-alselwi/laravel-arabic-html)[ RSS](/packages/ab-alselwi-laravel-arabic-html/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (5)Used By (0)

Convert laravel view to arabic html (pdf) using ArPHP and dompdf with arabic text
=================================================================================

[](#convert-laravel-view-to-arabic-html-pdf-using-arphp-and-dompdf-with-arabic-text)

To handle Arabic text issue in a more clean way with no need to hack dompdf script at all.

This package makes it easy to convert view blade to pdf using [laravel-dompdf](https://github.com/barryvdh/laravel-dompdf) and [Ar-PHP](https://github.com/khaled-alshamaa/ar-php).

قمنا بكتابة هذا الباكج لدعم اللغة العربية في مكتبة [laravel-dompdf](https://github.com/barryvdh/laravel-dompdf) من خلال استخدام [Ar-PHP](https://github.com/khaled-alshamaa/ar-php)سيقوم الباكج بتنزيل المكتبات المطلوبة في حال كانت غير موجودة دون الحاجة لتنزيلها كلاً على حده.

يوفر هذا الباكج حالياً دالة واحدة فقط وهي toArabicHTML() بالاضافة إلى انه يمكنك استخدام المكتبات الأصلية في تحويل أي محتوى إلى ملف pdf .

Contents
--------

[](#contents)

- [Installation](#installation)
    - [Package Installation](#package-installation)
- [Usage](#usage)

Requirements
------------

[](#requirements)

- DOM extension
- MBString extension
- php-font-lib
- php-svg-lib

Note that some required dependencies may have further dependencies (notably php-svg-lib requires sabberworm/php-css-parser).

### Recommendations

[](#recommendations)

- OPcache (OPcache, XCache, APC, etc.): improves performance
- GD (for image processing)
- IMagick or GMagick extension: improves image processing performance

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

[](#installation)

### Package Installation

[](#package-installation)

Install the package using composer:

```
composer require ab-alselwi/laravel-arabic-html
```

### Configuration

[](#configuration)

فقط هنا تحتاج للقيام باعداد المكتباات المرتبطة .

The defaults configuration settings are set in `config/dompdf.php`. Copy this file to your own config directory to modify the values. You can publish the config using this command:

```
    php artisan vendor:publish --provider="Barryvdh\DomPDF\ServiceProvider"
```

ينصح بتحديد مجلد الخطوط في المسار storage\\fonts .

You need to setup font\_dir in config\\dompdf by copy fonts folder to storage\\fonts or any folder with read and write permissions. You should be carful when write css , and font . you can't use font-weight:number like font-weight:600 ; just use font-weight:bold.

بعض التنسيقات قد لا يتم دعمها في dompdf مثل font-weight مع القيم الرقمية بالاضافة للعديد من التنسيقات التي تعتمد على flex box , ولعرض رسالة خطأ في حال وجود أي تنسيقات غير مدعومة يمكنك تغيير اعدادات عرض الخطاء كما يلي :

'show\_warnings' =&gt; true , // Throw an Exception on warnings from dompdf

for more detials about dompdf settings :

-
-

Usage
-----

[](#usage)

To handle Arabic text issue in a more clean way with no need to hack dompdf script at all.We use View macro, so use view('your\_blade\_view\_name')-&gt;toArabicHTML() to support any content in Arabic . [dompdf/dompdf#712 (comment)](https://github.com/dompdf/dompdf/issues/712#issuecomment-650592099)

### function parameters :

[](#function-parameters-)

- $line\_length :int ,optional, default 100. max length in line.
- $hindo :bool, optional, default false. convert numbers in text to hindo.
- $forcertl :bool, optional, default false. force right to left document direction.

تسختدم الدالة دالة utf8Glyphs الموجودة في مكتبة Ar-PHP لذا يمكنك أن تقوم بتخصيص بارامترات هذه الدالة حيث :

- 1 - $line\_length : اختياري رقم - في حال وجود نصوص طويلة قد يتطلب منك تحديد كم حرفاً في السطر الواحد قمنا بتعديل القيمة الافتراضية من 50 الى 100 حرف .
- 2- $hindo : اختياري قيمة منطقية bool في حال رغبت في تحويل الأرقام الموجودة في المستند إلى أرقام هندية قمنا بتعديل القيمة الافتراضية إلى false حيث ستبقى الأرقام على حالها بألارقام العربية والتي تكتب في اللغة الانجليزية حالياُ
- 3- $forcertl : اختياري قيمة منطقية bool تتوافق القيمة الافتراضية مع الدالة الأصلية false حيث تشير إلى فرض تحويل اتجاه المستند من اليمين إلى اليسار

Example:

```
$html = view('invoice')->toArabicHTML();

$pdf = PDF::loadHTML($html)->output();

$headers = array(
    "Content-type" => "application/pdf",
);

// Create a stream response as a file download
return response()->streamDownload(
    fn () => print($pdf), // add the content to the stream
    "invoice.pdf", // the name of the file/stream
    $headers
);
```

هذا هو شكل ال view invoice.blade.php

```
DOCTYPE html>

    Arabic Invoice

        * {
            font-family: DejaVu Sans !important;
        }

        body {
            font-size: 16px;
            font-family: 'DejaVu Sans', 'Roboto', 'Montserrat', 'Open Sans', sans-serif;
            padding: 10px;
            margin: 10px;

            color: #777;
        }

        body {
            color: #777;
            text-align: right;
        }

        body h1 {

            margin-bottom: 0px;
            padding-bottom: 0px;
            color: #000;
        }

        body h3 {

            margin-top: 10px;
            margin-bottom: 20px;
            color: #555;
        }

        body a {
            color: #06f;
        }

        @page {
            size: a4;
            margin: 0;
            padding: 0;
        }

        .invoice-box table {
            direction: ltr;
            width: 100%;
            text-align: right;
            border: 1px solid;
            font-family: 'DejaVu Sans', 'Roboto', 'Montserrat', 'Open Sans', sans-serif;
        }

        .row {
            display: block;
            padding-left: 24;
            padding-right: 24;
            page-break-before: avoid;
            page-break-after: avoid;
        }

        .column {
            display: block;
            page-break-before: avoid;
            page-break-after: avoid;
        }

            بيانات باللغة العربية

    ان هذا عبارة عن قالب عادي
    ومن هنا قمنا بعرض قالب اعتيادي فقط كمثال توضيحي .

                                فاتورة #: 123
                                الانشاء : يناير 1, 2015
                                تاريخ : فبراير 1, 2015

                العنصر

                السعر

                تصميم موقع

                $300.00

                استضافة (3 أشهر )

                $75.00

                نطاق (1 عام )

                $10.00

                الإجمالي :

                $385.00

                انما نحن هنا نقوم بكتابة نصوص عربية فلما لا يكون هناك اخرى مما قد يحتم علينا أن نكتب أكثر.
                وعليه فإن السطر هذا يعتبر سطر جديد

```

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance27

Infrequent updates — may be unmaintained

Popularity41

Moderate usage in the ecosystem

Community12

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

Every ~115 days

Total

4

Last Release

1090d ago

PHP version history (2 changes)0.1.0PHP &gt;=7.3

0.2.0PHP ^7.3||^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/0c4b475a2611480502ab96de028a7b19301ec27e0a049b47f71c99f3e054b498?d=identicon)[Ab-Alselwi](/maintainers/Ab-Alselwi)

---

Top Contributors

[![Ab-Alselwi](https://avatars.githubusercontent.com/u/45919148?v=4)](https://github.com/Ab-Alselwi "Ab-Alselwi (16 commits)")

---

Tags

arabicarabic-glyphsarabic-calendararabic-htmlarabic-dompdf

### Embed Badge

![Health badge](/badges/ab-alselwi-laravel-arabic-html/health.svg)

```
[![Health](https://phpackages.com/badges/ab-alselwi-laravel-arabic-html/health.svg)](https://phpackages.com/packages/ab-alselwi-laravel-arabic-html)
```

###  Alternatives

[rcrowe/twigbridge

Adds the power of Twig to Laravel

9105.9M50](/packages/rcrowe-twigbridge)[tightenco/jigsaw

Simple static sites with Laravel's Blade.

2.2k438.5k29](/packages/tightenco-jigsaw)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[moonshine/moonshine

Laravel administration panel

1.3k217.1k59](/packages/moonshine-moonshine)[livewire/blaze

A tool for optimizing Blade component performance by folding them into parent templates

688221.3k17](/packages/livewire-blaze)[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

703141.0k7](/packages/tallstackui-tallstackui)

PHPackages © 2026

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