PHPackages                             apachish/php-persian-number-to-words - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. apachish/php-persian-number-to-words

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

apachish/php-persian-number-to-words
====================================

Converts number to words in persian

058PHP

Since Apr 9Pushed 3y ago1 watchersCompare

[ Source](https://github.com/apachish/php-persian-number-to-words)[ Packagist](https://packagist.org/packages/apachish/php-persian-number-to-words)[ RSS](/packages/apachish-php-persian-number-to-words/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Convert Numbers to Words In Persian
===================================

[](#convert-numbers-to-words-in-persian)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e9409f5bf8dee67c9fdcef76a32b5cc1b8732bed9dbf5a284bc9022692222a0a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6f6a7461626161686e2f7068702d7065727369616e2d6e756d6265722d746f2d776f7264732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mojtabaahn/php-persian-number-to-words)[![Total Downloads](https://camo.githubusercontent.com/d88d96e7faffebbd66be5de3c5113680ac3ae39dcc9a2170679634f651f29bb0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6f6a7461626161686e2f7068702d7065727369616e2d6e756d6265722d746f2d776f7264733f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mojtabaahn/php-persian-number-to-words)[![Repo Size](https://camo.githubusercontent.com/7b62242358a6ea48f725424eeb82893701fcd69d9edb5204065eab4575d6e343/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f6d6f6a7461626161686e2f7068702d7065727369616e2d6e756d6265722d746f2d776f7264733f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mojtabaahn/php-persian-number-to-words)[![Repo Size](https://camo.githubusercontent.com/c719e1d244d6323fada741670eb2defe6c057759c08dec694e7a47124c71ab20/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d6f6a7461626161686e2f7068702d7065727369616e2d6e756d6265722d746f2d776f7264733f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mojtabaahn/php-persian-number-to-words)

This packages offers ability to convert numbers to words in persian. Words and phrases are fully configurable, so it is possible to use it for all persian language family with configuration.

Requirement
-----------

[](#requirement)

This package requires **PHP 8** or higher.

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

[](#installation)

You can install the package via composer:

```
composer require apachish/php-persian-number-to-words
```

Usage
-----

[](#usage)

```
$dictionary = new Apachish\PersianNumberToWords\Dictionary();

$converter = new Apachish\PersianNumberToWords\PersianNumberToWords($dictionary);

echo $converter->convert(0);
// صفر

echo $converter->convert(-10);
// منفی ده

echo $converter->convert(229);
// دویست و بیست و نه

echo $converter->convert(999999999);
// نهصد و نود و نه میلیون و نهصد و نود و نه هزار و نهصد و نود و نه
```

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

[](#configuration)

It is possible to customize the way output should look like using Dictionary class setter methods.

```
$dictionary = (new Apachish\PersianNumberToWords\Dictionary())
    ->setZero('هیچ')
    ->setNegative('منهای')
    ->setSeparator(' ُ ');

// Also ->setUnits(array $units) & -> setSuffixes(array $suffixes) are availabe

$converter = new Apachish\PersianNumberToWords\PersianNumberToWords($dictionary);

echo $converter->convert(0);
// هیچ

echo $converter->convert(-10);
// منهای ده

echo $converter->convert(229);
// دویست ُ بیست ُ نه
```

Default Configuration
---------------------

[](#default-configuration)

This code is a part of Dictionary class, you can see all default Configuration:

```
class Dictionary
{

    protected string $zero = 'صفر';

    protected string $negative = 'منفی';

    protected string $separator = " و ";

    protected array $units = [
        1 => 'یک',
        2 => 'دو',
        3 => 'سه',
        4 => 'چهار',
        5 => 'پنج',
        6 => 'شش',
        7 => 'هفت',
        8 => 'هشت',
        9 => 'نه',
        10 => 'ده',
        11 => 'یازده',
        12 => 'دوازده',
        13 => 'سیزده',
        14 => 'چهارده',
        15 => 'پانزده',
        16 => 'شانزده',
        17 => 'هفده',
        18 => 'هجده',
        19 => 'نوزده',
        20 => 'بیست',
        30 => 'سی',
        40 => 'چهل',
        50 => 'پنجاه',
        60 => 'شصت',
        70 => 'هفتاد',
        80 => 'هشتاد',
        90 => 'نود',
        100 => 'صد',
        200 => 'دویست',
        300 => 'سیصد',
        400 => 'چهارصد',
        500 => 'پانصد',
        600 => 'ششصد',
        700 => 'هفتصد',
        800 => 'هشتصد',
        900 => 'نهصد'
    ];

    protected array $suffixes = [
        3 => 'هزار',
        6 => 'میلیون',
        9 => 'میلیارد',
        12 => 'بیلیون',
        15 => 'بیلیارد',
        18 => 'تریلیون',
        21 => 'تریلیارد',
        24 => 'کوآدریلیون',
        27 => 'کادریلیارد',
        30 => 'کوینتیلیون',
        33 => 'کوانتینیارد',
        36 => 'سکستیلیون',
        39 => 'سکستیلیارد',
        42 => 'سپتیلیون',
        45 => 'سپتیلیارد',
        48 => 'اکتیلیون',
        51 => 'اکتیلیارد',
        54 => 'نانیلیون',
        57 => 'نانیلیارد',
        60 => 'دسیلیون',
        63 => 'دسیلیارد',
    ];

    // Setters & Helpers...

}
```

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity22

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/54353f44063ca1c991133d9ce8cc3c429ebbee2f82df630202996f1a65de4091?d=identicon)[apachish](/maintainers/apachish)

---

Top Contributors

[![apachish](https://avatars.githubusercontent.com/u/6897327?v=4)](https://github.com/apachish "apachish (1 commits)")

### Embed Badge

![Health badge](/badges/apachish-php-persian-number-to-words/health.svg)

```
[![Health](https://phpackages.com/badges/apachish-php-persian-number-to-words/health.svg)](https://phpackages.com/packages/apachish-php-persian-number-to-words)
```

###  Alternatives

[mnshankar/linear-regression

PHP package for computation of simple linear regression parameters

2323.3k](/packages/mnshankar-linear-regression)

PHPackages © 2026

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