2.2 documentation

Table of Content

Version Compatibility

Laravel Avatar
4.1.x 2.1.x
4.2.x 2.2.x

Installation

To install through composer, simply put the following in your composer.json file:

{
    "require": {
        "orchestra/avatar": "2.2.*"
    }
}

And then run composer install from the terminal.

Quick Installation

Above installation can also be simplify by using the following command:

composer require "orchestra/avatar=2.2.*"

Configuration

Add Orchestra\Avatar\AvatarServiceProvider service provider in app/config/app.php.

'providers' => array(

    // ...
    'Orchestra\Avatar\AvatarServiceProvider',
),

You might also want to add Orchestra\Avatar\Facade to class aliases in app/config/app.php:

'aliases' => array(

    // ...
    'Orchestra\Avatar' => 'Orchestra\Avatar\Facade',
),

Usage

You can easily display an avatar by passing a User instance.

<?php

$user = User::find(1);

$avatar = Orchestra\Avatar::user($user)->render();