2017 © Pedro Peláez
 

library avy-get

This package attempts to get an avatar from an email address by checking Google+ and Gravatar.

image

12-stars-media/avy-get

This package attempts to get an avatar from an email address by checking Google+ and Gravatar.

  • Monday, February 27, 2017
  • by TimothyLoyer
  • Repository
  • 3 Watchers
  • 1 Stars
  • 279 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 4 Versions
  • 3 % Grown

The README.md

AvyGet Avatar Getter

This package attempts to get an avatar from an email address by checking the PicasaWeb and Gravatar APIs., (*1)

Requirements

PHP 5.5 and later., (*2)

Composer

Update your composer.json, (*3)

{
  "require": {
    "12-stars-media/avy-get": "0.2.*"
  }
}

Followed by composer install., (*4)

Getting Started

To Use PicasaWeb API

Create app and API key to use Google+ API. 1) Set up a project on the Google Developer Console 2) Enable Google+ API 3) Create a Public API Access key, (*5)

Set environment variables so that AvyGet can authenticate you with Google's API. - API_GOOGLE_APP_NAME (the name of your project or app) - API_GOOGLE_API_KEY (your API key created in step 3 above), (*6)

Basic Usage

Instantiate a new instance for each email you need a profile image for:, (*7)

$avyGet = new AvyGet(
  'avyget@example.com', // Email address to find image for
  120                   // Desired image size in pixels (optional)
);

$avatar = $avyGet->url(); // Returns url for image

Documentation

Instantiate AvyGet

new AvyGet( string $email [, int $size = 200 ] [, array $services = [] ] );, (*8)

Only the email is required, but you can request an avatar in a specific size and also modify what services are used to find avatars., (*9)

Avatar Source Services

Default services and order of preference is:, (*10)

protected $services = [
    'AvyGet\Services\Google',
    'AvyGet\Services\Gravatar',
];

More services can be created by extending AvyGet\Services\ProfilePhotoAbstract and implementing the AvyGet\Services\ImageUrlInterface., (*11)

Methods

resize( int $size )

Returns modified AvyGet instance (i.e. it is chainable)., (*12)

$avyGet->resize(150)->url();, (*13)

url()

Returns the url instantiated with AvyGet or null if no avatar could be found for the provided email., (*14)

$avyGet->url();, (*15)

urlArray( array $sizes )

Returns an indexed or associative array relative to what to provide it- replaces your size values with the appropriate URLs., (*16)

$avyGet->urlArray([
  32,
  128,
  512
]);

/**
 * [
 *   'http://www.example.com/image?size=32',
 *   'http://www.example.com/image?size=128',
 *   'http://www.example.com/image?size=512',
 * ]
 */
$avyGet->urlArray([
  'small'  => 32,
  'medium' => 128,
  'large'  => 512,
]);

/**
 * [
 *   'small'  => 'http://www.example.com/image?size=32',
 *   'medium' => 'http://www.example.com/image?size=128',
 *   'large'  => 'http://www.example.com/image?size=512',
 * ]
 */

License

AvyGet is open-sourced software licensed under the MIT license, (*17)

The Versions

27/02 2017

dev-master

9999999-dev

This package attempts to get an avatar from an email address by checking Google+ and Gravatar.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Tim Loyer

27/02 2017

0.2.0

0.2.0.0

This package attempts to get an avatar from an email address by checking Google+ and Gravatar.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Tim Loyer

25/06 2015

0.1.1

0.1.1.0

This package attempts to get an avatar from an email address by checking Google+ and Gravatar.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Tim Loyer

17/06 2015

0.1.0

0.1.0.0

This package attempts to get an avatar from an email address by checking Google+ and Gravatar.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Tim Loyer