PHP code example of emanueleminotto / gravatar-service-provider

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

    

emanueleminotto / gravatar-service-provider example snippets


use EmanueleMinotto\GravatarServiceProvider\GravatarServiceProvider;

$app->register(new GravatarServiceProvider(), array(
    'gravatar.http_client' => new GuzzleHttp\Client(), // default null, optional
    'gravatar.twig' => false, // default true, optional
));

$app->get('/hello/{email}', function ($email) use ($app) {
    $profile = $app['gravatar']->getProfile($email);

    return 'Hello ' . $profile['preferredUsername'];
});