| Recommend this page to a friend! | 
|  Download | 
| Info | Documentation |  Files |  Install with Composer |  Download | Reputation | Support forum | Blog | Links | 
| Ratings | Unique User Downloads | Download Rankings | ||||
| Not yet rated by the users | Total: 20 | All time:  11,349 This week: 206  | ||||
| Version | License | PHP version | Categories | |||
| ph2gravatar 1.0 | GNU General Publi... | 5 | PHP 5, Graphics, Web services | 
| Description | Author | |
| This class can get the Gravatar user image link with an email. | 
_Easy as it's supposed to be ?_
pH2Gravatar is lightweight gravatar library giving you an elegant way to generate gravatar profile photos from email addresses ?
With composer:
composer require ph-7/ph2gravatar
require __DIR__ . '/vendor/autoload.php';
use PH7\PH2Gravatar\Image;
?>
<!-- Here, we leave the default parameters. https://en.gravatar.com/site/implement/images/ -->
<!-- By default, the image size is 200px -->
<img src="<?= Image::get('[email protected]') ?>" alt="My gravatar image" />
<!-- Here, we set the gravatar image size to 400px -->
<img src="<?= Image::get('[email protected]', ['size' => 400]) ?>" alt="My gravatar image" />
require __DIR__ . '/vendor/autoload.php';
use PH7\PH2Gravatar\Image as Gravatar;
// Show the gravatar image link
echo Gravatar::get('[email protected]', [
    'size' => 80,
    'rating' => 'pg',
    'display' => 'retro'
]);
// https://www.gravatar.com/avatar/9c47a7bb2aec6e61df372a8f8446ed9d?s=80&r=pg&d=retro
require __DIR__ . '/vendor/autoload.php';
use PH7\PH2Gravatar\Image as GravatarImage;
$email = '[email protected]';
$size = 400;
$imageUrl = GravatarImage::get($email, [
    'size' => $size,
    'display' => '404',
    'rating' => 'g'
    ]
);
// $imageUrl output
// https://www.gravatar.com/avatar/4995f3f0b59f4abfda86e74f92896f3b?s=400&r=g&d=404
I'm [Pierre-Henry Soria][author-url]. A dedicated, passionate and positive software engineer ? You can keep in touch with me at _hi [[AT]] ph7 {{D0T}} me_ ?
[![@phenrysay][twitter-image]][twitter-url] [![pH-7][github-image]][github-url]
Are you enjoying my work? Offer me a coffee and boost the software development at the same time! ?
[![Watch the video][video-thumbnail]](https://www.youtube.com/watch?v=DeGYaRkStaE)
? Click here to watch on YouTube
pH2Gravatar is distributed under [MIT][license-url] license ? Enjoy!
<!-- GitHub's Markdown reference links --> [author-url]: https://pierrehenry.be [license-url]: https://opensource.org/licenses/MIT [twitter-url]: https://twitter.com/phenrysay [twitter-image]: https://img.shields.io/badge/Twitter-1DA1F2?style=for-the-badge&logo=twitter&logoColor=white [github-url]: https://github.com/pH-7 [github-image]: https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white [video-thumbnail]: https://i1.ytimg.com/vi/DeGYaRkStaE/hqdefault.jpg
|  Files (10) | 
| File | Role | Description | ||
|---|---|---|---|---|
|  .github (1 file, 1 directory) | ||||
|  media (1 file) | ||||
|  src (1 file) | ||||
|  tests (1 file) | ||||
|    composer.json | Data | Auxiliary data | ||
|    LICENSE.md | Lic. | License text | ||
|    phpunit.xml.dist | Data | Auxiliary data | ||
|    README.md | Doc. | Documentation | ||
|    save-code.sh | Data | Auxiliary data | ||
| The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. | 
|  Install with Composer | 
| Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
| 100% | 
 | 
 | 
| Applications that use this package | 
 If you know an application of this package, send a message to the author to add a link here.
 If you know an application of this package, send a message to the author to add a link here.