PHP code example of jinas / dhivatar

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

    

jinas / dhivatar example snippets



use Jinas\Dhivatar\DhivatarFactory;

(string) DhivatarFactory::create()
    ->setText('ޖިނާސް')
    ->build()
  	->encode('data-url');


use Jinas\Dhivatar\DhivatarFactory;

DhivatarFactory::create()
            ->setText("ޖިނާސް", "#C93839")
            ->setFontSize(255)
            ->setBackground("#3083AD")
            ->build()
            ->save('file', 80, 'jpg');  // save the image in 80% quality and  jpg format defined by third parameter