Laravel 8 – 11
PHP 7.4+
No release in over 2 years
Low commit activity in last 18 months
Generate an Adorable Avatar for Laravel
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

mockery/mockery
^1.4
^1.0 || ^2.0
^6.0 || ^7.0 || ^8.0 || ^9.0
phpstan/phpstan-strict-rules
^1.1
phpunit/phpunit
^9.5 || ^10.0 || ^11.0
vimeo/psalm
^4.0 || ^5.6

Runtime

^8.0 || ^9.0 || ^10.0 || ^11.0
 Project Readme

Adorable Avatar for Laravel

LaravelAdorable is an library to generate nice avatars on Laravel.

Latest Version Downloads Workflow Status Quality Gate Coverage Status

avatar1

Installation

You may use Composer to install this package into your Laravel project:

composer require asbiin/laravel-adorable

You don't need to add this package to your service providers.

Support

This package supports Laravel 8 and newer, and has been tested with php 7.4 and newer versions.

Configuration

You can publish the LaravelAdorable configuration in a file named config/adorable.php. Just run this artisan command:

php artisan vendor:publish --tag="laraveladorable-config"

This package depends on intervention/image. It requires one of the following image libraries:

  • GD Library (>=2.0)
  • or: Imagick PHP extension (>=6.5.7)

You can configure the image library to use in the driver setting of the config/adorable.php file.

Usage

Use LaravelAdorable facade to generate avatar:

use Illuminate\Support\Str;
use LaravelAdorable\Facades\LaravelAdorable;

…

  $size = 200;
  $hash = Str::uuid()->toString();
  $dataUrl = LaravelAdorable::get($size, $hash);
  // $dataUrl: "data:image/png;base64,..."

This generates a base64 data-url content, like data:image/png;base64,….

You can display a data-url in html with:

  <img src="{{ $dataUrl }}" alt="avatar" />

License

Author: Alexis Saettler

Copyright © 2022.

Licensed under the MIT License. View license.

Inspiration

This work is mainly inspired by itsthatguy/avatars-api-middleware (MIT License).

Images resources are Copyright (c) 2014 Adorable IO LLC.