PHP code example of amyavari / persian-faker-php

1. Go to this page and download the library: Download amyavari/persian-faker-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

amyavari / persian-faker-php example snippets


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

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'

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

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

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

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

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

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)
// 'ثانیه رنگ هفته ماه ملی پاییز انسان تنظیم تخم‌مرغ بخار نهاد صعود بیعت تند تفکر توانا پناهگاه برنامه سکه برگ'

// 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'

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