PHP code example of bear8421 / gravatar

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

    

bear8421 / gravatar example snippets



ear8421\Helper\Gravatar\Gravatar;

$gravatar = new Gravatar();
$gravatar->setCacheStatus(true)
    ->setCachePath(__DIR__.'/cache')
    ->setUsername('nguyenanhung')
    ->init();

// Get Avatar
$avatar = $gravatar->showAvatar(300);

// Get Avatar from Email Address
$avatarEmail = gravatarUrlWithEmail('[email protected]');