Giter Site home page Giter Site logo

laravel-gravatar's Introduction

Laravel Gravatar Helper

Latest Version on Packagist Software License tests SymfonyInsight Grade Quality Score Code Coverage Total Downloads

The easiest way to generate Gravatar avatar URL, with multiple connections support.

Installation

You can install this package using the Composer manager:

$ composer require elfsundae/laravel-gravatar

Then copy the configuration file to your application:

$ cp vendor/elfsundae/laravel-gravatar/config/gravatar.php config/gravatar.php

For Lumen, you need to load the configuration file in your bootstrap/app.php :

$app->configure('gravatar');

API

gravatar() is a global helper function you can use anywhere.

/**
 * Generate Gravatar avatar URL for the given email address.
 *
 * @param  string      $email       Email or email hash
 * @param  string|int  $connection  Connection name or image size
 * @param  string|int  $size        Connection name or image size
 * @return string
 */
function gravatar($email, $connection = 'default', $size = null)

Usage

// For an email address, using the "default" connection configuration
gravatar('[email protected]');

// For an email MD5 hash, using the "default" connection configuration
gravatar('b48def645758b95537d4424c84d1a9ff');

// Using the "large" connection
gravatar($email, 'large');

// Using the "default" connection, and overriding "size" parameter to 100
gravatar($email, 100);

// Using the "avatar" connection, and overriding "size" parameter to 100
gravatar($email, 'avatar', 100);
gravatar($email, 100, 'avatar');

laravel-gravatar's People

Contributors

elfsundae avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

laravel-gravatar's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.