PHP code example of baruch4413 / identicon

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

    

baruch4413 / identicon example snippets




use Bitverse\Identicon\Identicon;
use Bitverse\Identicon\Color\Color;
use Bitverse\Identicon\Generator\RingsGenerator;
use Bitverse\Identicon\Preprocessor\MD5Preprocessor;

$generator = new RingsGenerator();
$generator->setBackgroundColor(Color::parseHex('#EEEEEE'));

$identicon = new Identicon(new MD5Preprocessor(), $generator);

$icon = $identicon->getIcon('hello world');

file_put_contents('helloworld.svg', $icon);