PHP code example of ranvis / identicon

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

    

ranvis / identicon example snippets


use Ranvis\Identicon;

 . 'YOUR_RANDOM_SALT_HERE_&ar/1R#S[|=hDF');

$hash = $_GET['hash'] ?? '';
//$hash = isset($_GET['hash']) ? $_GET['hash'] : ''; // PHP 5
if (!preg_match('/\A[0-9a-f]{32}\z/', $hash)) {
    http_response_code(404);
    exit;
}

$tile = new Identicon\Tile();
$identicon = new Identicon\Identicon(64, $tile);
header('Cache-Control: public, max-age=31556952');
$identicon->draw($hash)->output();