khaled-sadek / blade-boring-avatars
Blade components to auto generate boring avatars based on name
Installs: 27
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 1
Forks: 2
Open Issues: 1
pkg:composer/khaled-sadek/blade-boring-avatars
Requires
- php: ^8.2
- ext-json: *
- illuminate/support: ^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
Requires (Dev)
- laravel/pint: ^1.25.1
- nunomaduro/collision: ^7.0|^8.0|^9.0
- orchestra/testbench: ^5.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
- phpstan/phpstan: ^1.11
- phpunit/phpunit: ^10.0|^11.0
This package is auto-updated.
Last update: 2025-09-25 07:54:32 UTC
README
A Blade version of Boring Avatars. Built using Laravel Blade.
Based on Boring Avatar's description,
Boring Avatars a tiny JavaScript React library that generates custom, SVG-based, round avatars from any username and color palette.
This package provides a Blade component you can use directly in your Laravel projects.
Features
- Similar API with the React version of Boring Avatars.
Installation
composer require khaled-sadek/blade-boring-avatars
Compatibility
- PHP: 8.2 or higher
- Laravel: 10.x, 11.x, 12.x
Note for Laravel 9.x and below users: If you're using Laravel 9.x or below, please use version 1.x of this package which supports PHP 8.1 and Laravel 7-9.
Publishing to Packagist
This package is set up to automatically publish to Packagist when a new Git tag is pushed. To enable this:
- Go to your Packagist account and get an API token from your tokens page.
- In your GitHub repository, go to Settings > Secrets and variables > Actions
- Add the following repository secrets:
PACKAGIST_TOKEN
: Your Packagist API tokenPACKAGIST_USERNAME
: Your Packagist username
After setting up these secrets, pushing a new tag prefixed with v
(for example, v2.0.0
) will automatically trigger a new release on Packagist.
This package auto-discovers its service provider, so no manual registration is required.
Props
Props:
size
: number- Default:
40
- Default:
name
: string- Default:
"Clara Barton"
- Default:
colors
: array[]- Accepts a php array of colors.
- Default:
["#92A1C6", "#146A7C", "#F0AB3D", "#C271B4", "#C20D90"]
Usage
Basic usage (with default props):
<x-avatar />
With props:
<!-- view.blade.php where $colors is a valid PHP array --> <x-avatar size="80" name="Khaled Sadek" :colors="$colors" />
Backward compatibility: the PascalCase tag <x-Avatar />
remains available.
Credits
Credits to @hihayk (GitHub) and @josep_martins (GitHub) for creating the original Boring Avatars library at boringdesigners!