PHPackages                             amyavari/persian-faker-php - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. amyavari/persian-faker-php

ActiveLibrary[Testing &amp; Quality](/categories/testing)

amyavari/persian-faker-php
==========================

This is an extension for fakerphp/faker to support Persian language

v1.4.0(2mo ago)261.9k1MITPHPPHP ^8.2.0CI passing

Since Feb 6Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/amyavari/persian-faker-php)[ Packagist](https://packagist.org/packages/amyavari/persian-faker-php)[ RSS](/packages/amyavari-persian-faker-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (8)Versions (12)Used By (0)

Persian Faker for PHP
=====================

[](#persian-faker-for-php)

[![](https://camo.githubusercontent.com/305f8478084beaf12a257df65f167af6a1834d0648c472726bf87c91eb90d513/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f5065727369616e25323046616b65722532305048502e706e673f7468656d653d6461726b267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d2d2d6465762b616d7961766172692532467065727369616e2d66616b65722d706870267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d4d616b652b66616b652b5065727369616e2b616e642b4972616e2d73706563696669632b646174612b776974682b65617365266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d68747470732533412532462532467777772e7068702e6e6574253246696d616765732532466c6f676f732532466e65772d7068702d6c6f676f2e737667)](https://camo.githubusercontent.com/305f8478084beaf12a257df65f167af6a1834d0648c472726bf87c91eb90d513/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f5065727369616e25323046616b65722532305048502e706e673f7468656d653d6461726b267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d2d2d6465762b616d7961766172692532467065727369616e2d66616b65722d706870267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d4d616b652b66616b652b5065727369616e2b616e642b4972616e2d73706563696669632b646174612b776974682b65617365266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d68747470732533412532462532467777772e7068702e6e6574253246696d616765732532466c6f676f732532466e65772d7068702d6c6f676f2e737667)

[![PHP Version](https://camo.githubusercontent.com/70ef368ae1b317d3dc8993680fb40572b7bcbcb3b99f6c01b31721b087e268ac/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f616d7961766172692f7065727369616e2d66616b65722d706870)](https://camo.githubusercontent.com/70ef368ae1b317d3dc8993680fb40572b7bcbcb3b99f6c01b31721b087e268ac/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f616d7961766172692f7065727369616e2d66616b65722d706870)[![Packagist Version](https://camo.githubusercontent.com/fde13ece1f0ac434d4632f9b0c46fe585d30159a5932923afcbc5846751f2444/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616d7961766172692f7065727369616e2d66616b65722d7068703f6c6162656c3d76657273696f6e)](https://camo.githubusercontent.com/fde13ece1f0ac434d4632f9b0c46fe585d30159a5932923afcbc5846751f2444/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616d7961766172692f7065727369616e2d66616b65722d7068703f6c6162656c3d76657273696f6e)[![Packagist Downloads](https://camo.githubusercontent.com/0cf161799cb60332ec16673773e44caa51ff8a44cbbd23227c6116a566a9f3f7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616d7961766172692f7065727369616e2d66616b65722d706870)](https://camo.githubusercontent.com/0cf161799cb60332ec16673773e44caa51ff8a44cbbd23227c6116a566a9f3f7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616d7961766172692f7065727369616e2d66616b65722d706870)[![Packagist License](https://camo.githubusercontent.com/b8969634f1f07136dbbb459da52fd8b7fdc34da6cc694b81d1e190104ba3ffad/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f616d7961766172692f7065727369616e2d66616b65722d706870)](https://camo.githubusercontent.com/b8969634f1f07136dbbb459da52fd8b7fdc34da6cc694b81d1e190104ba3ffad/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f616d7961766172692f7065727369616e2d66616b65722d706870)[![Tests](https://camo.githubusercontent.com/fc652259f69bfc7566e7d06caf07b0d762ef0d8f9caeef3318b264e63e390d86/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f616d7961766172692f7065727369616e2d66616b65722d7068702f74657374732e796d6c3f6c6162656c3d7465737473)](https://camo.githubusercontent.com/fc652259f69bfc7566e7d06caf07b0d762ef0d8f9caeef3318b264e63e390d86/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f616d7961766172692f7065727369616e2d66616b65722d7068702f74657374732e796d6c3f6c6162656c3d7465737473)

---

`persian-faker-php` is an extension for [fakerphp/faker](https://fakerphp.org/) that generates Persian-language and Iran-specific data, such as Persian text, addresses, personal details, and more.
To view the Persian documentation, please refer to [docs/fa/01\_getting\_started.md](/docs/fa/01_getting_started.md).

این کتابخانه بر پایه کتابخانه [fakerphp/faker](https://fakerphp.org/) ساخته شده و هدف آن پشتیبانی از متن و مشخصات فارسی به‌طور خاص برای اطلاعات کشور ایران است.
برای مشاهده راهنمای فارسی، لطفاً به فایل [docs/fa/01\_getting\_started.md](/docs/fa/01_getting_started.md) مراجعه کنید.

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

[](#requirements)

- PHP version `8.2.0` or higher

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#instantiation)
- [Usage](#usage)
- [Available Methods](#available-methods)
    - [Person Details](#person-details)
    - [Address](#address)
    - [Phone](#phone)
    - [Company](#company)
    - [Text](#text)
    - [Payment](#payment)
    - [Color](#color)
    - [Internet](#internet)
- [Contributing](#contributing)

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

[](#installation)

To install the package, use Composer.

```
composer require --dev amyavari/persian-faker-php
```

**Note:** This package is intended for use in a development environment, so it's recommended to install it with the `--dev` flag.

Usage
-----

[](#usage)

You can easily create an instance of Faker in your PHP projects by calling the `create()` method from the `Factory` class

```
$persianFaker = \AliYavari\PersianFaker\Factory::create();
```

### Usage Helper

[](#usage-helper)

If you prefer a simpler way to get a Persian Faker instance, you can use the global `persian_faker()` helper function provided by this package. This is especially useful in Laravel or any PHP project where global helpers are available.

```
$persianFaker = persian_faker();
```

This helper will automatically resolve the Faker instance, using the Laravel service container if available, or falling back to a direct instantiation otherwise.

Available Methods
-----------------

[](#available-methods)

Most methods in `persian-faker-php` are extensions of the [fakerphp/faker](https://fakerphp.org/) library, supporting only Persian language and Iran-specific data. The implementation and arguments for these methods are the same as those in the original Faker library.

### Person Details

[](#person-details)

To view the complete documentation for the person methods, please refer to [docs/en/02-person.md](./docs/en/02-person.md)

```
title($gender = null|'male'|'female')     // 'آقای'
titleMale()                               // 'آقای'
titleFemale()                             // 'خانم'
name($gender = null|'male'|'female')      // 'علی محمد یاوری'
firstName($gender = null|'male'|'female') // 'علی محمد'
firstNameMale()                           // 'علی محمد'
firstNameFemale()                         // 'نیوشا'
lastName()                                // 'یاوری'

// New method
nationalCode($state = null)               // '0087199084', '1127905589'
```

### Address

[](#address)

To view the complete documentation for the address methods, please refer to [docs/en/03-address.md](./docs/en/03-address.md)

```
secondaryAddress()                      // 'طبقه 2'
state()                                 // 'یزد'
city()                                  // 'یزد'
streetName()                            // 'پاسداران شمالی'
address()                               // 'خیابان کارگر، کوچه گلستان، پلاک 35

// Modified: accept optional argument
postcode($withSeparator = false|true)   // '1234567890' , '12345-67890'
```

### Phone

[](#phone)

To view the complete documentation for the phone methods, please refer to [docs/en/04-phone.md](./docs/en/04-phone.md)

```
// Modified: accept optional arguments
phoneNumber($separator = '', $state = null)     // '03512345678', '035-12345678'

// New methods
statePhonePrefix()                              // '035'
cellPhone($separator = '', $provider = null)    // '09121234567', '0912-123-4567'
```

### Company

[](#company)

To view the complete documentation for the company methods, please refer to [docs/en/05-company.md](./docs/en/05-company.md)

```
company()       // 'گروه نگاه'
catchphrase()   // 'یک قدم تا دنیای دیجیتال'
jobTitle()      // 'برنامه نویس PHP', 'مدیر محصول'
```

---

### Text

[](#text)

To view the complete documentation for the text methods, please refer to [docs/en/06-text.md](./docs/en/06-text.md)

```
word()                                                          // 'آتش', 'خاکستری'
words($nb = 3, $asText = false|true)                            // ['خاکستری', 'سریع' , 'دارچین'], 'خاکستری سریع دارچین'

sentence($nbWords = 6, $variableNbWords = true|false)           // '.نویس اتوبوس برنامه دار.', 'دیجیتال دنیا و بی یخ'
sentences($nb = 3, $asText = false|true)                        // ['خاکستری سریع دارچین','.یخ در بهشت.'], 'خاکستری سریع دارچین. یخ در بهشت.'

paragraph($nbSentences = 3, $variableNbSentences = true|false)  // 'خاکستری سریع دارچین اما اینجا. یخ در بهشت بها. دیجیتال دنیا و بی یخ..'
paragraphs($nb = 3, $asText = false|true)

text($maxNbChars = 200)
// 'ثانیه رنگ هفته ماه ملی پاییز انسان تنظیم تخم‌مرغ بخار نهاد صعود بیعت تند تفکر توانا پناهگاه برنامه سکه برگ'
```

### Payment

[](#payment)

To view the complete documentation for the payment methods, please refer to [docs/en/07-payment.md](./docs/en/07-payment.md)

```
// New methods
bank()                                                              // 'ملت', 'مهر ایران'
cardNumber($separator = '', $bank = null)                           // '6273 8157 2593 3210', '5894639748556308'
shebaNumber($withIR = true|false, $separator = '', $bank = null)    // 'IR72-0540-0008-5961-5112-7527-92'
```

### Color

[](#color)

To view the complete documentation for the color methods, please refer to [docs/en/08-color.md](./docs/en/08-color.md)

```
safeColorName()                       // 'سیاه', 'آبی'
colorName()                           // 'سبز زمردی', 'زغالی', 'زرد'
```

### Internet

[](#internet)

To view the complete documentation for the internet methods, please refer to [docs/en/09-internet.md](./docs/en/09-internet.md)

```
slug($nbWords = 6, $variableNbWords = true|false)   // 'نویس-اتوبوس-برنامه-دار', 'دیجیتال-دنیا-و-بی-یخ'
```

Contributing
------------

[](#contributing)

Thank you for considering contributing to the Persian Faker PHP! The contribution guide can be found in the [CONTRIBUTING.md](CONTRIBUTING.md)

License
-------

[](#license)

**Persian Faker PHP** was created by **[Ali Mohammad Yavari](https://www.linkedin.com/in/ali-m-yavari/)** under the **[MIT license](https://opensource.org/licenses/MIT)**.

---

This package utilizes the [nunomaduro/skeleton-php](https://github.com/nunomaduro/skeleton-php) repository as a starting point and for configuration settings.

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance89

Actively maintained with recent releases

Popularity25

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97% 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 ~53 days

Recently: every ~86 days

Total

8

Last Release

81d ago

Major Versions

v0.1.0 → v1.0.02025-02-17

### Community

Maintainers

![](https://www.gravatar.com/avatar/db5633fbb00751ef9caad7ae0a5c68f6f4fa397d4079114e5c91570cc11aa4d5?d=identicon)[amyavari](/maintainers/amyavari)

---

Top Contributors

[![amyavari](https://avatars.githubusercontent.com/u/56732838?v=4)](https://github.com/amyavari "amyavari (163 commits)")[![sadegh19b](https://avatars.githubusercontent.com/u/54643531?v=4)](https://github.com/sadegh19b "sadegh19b (5 commits)")

---

Tags

fakefakeriranpersianpersian-fakerphp-librarytddtdd-phptestingphpdevfakerpersian

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/amyavari-persian-faker-php/health.svg)

```
[![Health](https://phpackages.com/badges/amyavari-persian-faker-php/health.svg)](https://phpackages.com/packages/amyavari-persian-faker-php)
```

###  Alternatives

[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k43.5M5.2k](/packages/larastan-larastan)[zenstruck/foundry

A model factory library for creating expressive, auto-completable, on-demand dev/test fixtures with Symfony and Doctrine.

78311.9M97](/packages/zenstruck-foundry)[letsdrink/ouzo-goodies

Utility classes, test assertions and mocking framework extracted from Ouzo framework.

132617.9k7](/packages/letsdrink-ouzo-goodies)[quizlet/hammock

Hammock is a stand-alone mocking library for Hacklang.

27445.5k](/packages/quizlet-hammock)[mbezhanov/laravel-faker-provider-collection

A collection of custom Faker providers for your Laravel applications

2270.3k1](/packages/mbezhanov-laravel-faker-provider-collection)[doppiogancio/mocked-client

A simple way to mock a client

2174.9k3](/packages/doppiogancio-mocked-client)

PHPackages © 2026

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