PHP code example of furqat / laravel-avatar
1. Go to this page and download the library: Download furqat/laravel-avatar library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
furqat / laravel-avatar example snippets
'size' => 80,
'background_color' => '#8b75b7',
'font_family' => 'Arial',
'font_color' => '#ffffff',
use Furqat\LaravelAvatar\SvgAvatar;
$user = User::first();
// In this example avatar generate using with config styles
$avatar = new SvgAvatar('Furqat Mashrabjonov');
$user->avatar = $avatar->generate();
$user->save();
//or
//In this example you can change styles
$avatar = new SvgAvatar('Furqat Mashrabjonov');
$avatar->size(300);
$avatar->backgroundColor('#f00');
$avatar->color('#000');
$avatar->fontFamily('sans-serif');
$user->avatar = $avatar->generate();
$user->save();