3.2 documentation

Latest Stable Version Total Downloads MIT License

Avatar Component provide support for driver based avatar provider for your Laravel, PHP or Orchestra Platform application.

  1. Version Compatibility
  2. Installation
  3. Configuration
  4. Usage
  5. Change Log

Version Compatibility

Laravel Avatar
4.1.x 2.1.x
4.2.x 2.2.x
5.0.x 3.0.x
5.1.x 3.1.x
5.2.x 3.2.x@dev

Installation

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

{
    "require": {
        "orchestra/avatar": "~3.0"
    }
}

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=~3.0"

Configuration

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

'providers' => [

    // ...

    Orchestra\Avatar\AvatarServiceProvider::class,
],

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

'aliases' => [

    // ...

    'Avatar' => Orchestra\Support\Facade\Avatar::class,
],

Usage

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

<?php

use App\User;

$user = User::find(1);
$avatar = Avatar::user($user);

You can use it in a view by rendering it.

<img src="{{ $avatar }}" class="avatar">