PHP code example of mor / farsi-poem

1. Go to this page and download the library: Download mor/farsi-poem 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/ */

    

mor / farsi-poem example snippets


use FarsiPoem\FarsiPoem;

$poem = new FarsiPoem();


echo $poem->random()->plainText;



$poet_id = 2; // default = 0 : random poem from random poet

$poem->random($poet_id);

echo $poem->plainText;

$poem->save()->random();

echo $poem->plainText;

$poem->save()->random();

echo $poem->plainText; // show plain text of poem.

echo $poem->verses; // show object of verses (by ganjoor api).

echo $poem->verses(Int $count = 0); // only get $count verses: 0 means all verses.

echo $poem->versesAsPlain(Int $count = 0, String $seperator = ' / '):

echo $poem->poet;