Download the PHP package mmnijas/avatar without Composer
On this page you can find all versions of the php package mmnijas/avatar. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mmnijas/avatar
More information about mmnijas/avatar
Files in mmnijas/avatar
Package avatar
Short Description Avatar Generator is a lightweight PHP package designed to generate avatars based on user names. It offers two flexible modes for avatar generation, letter based avatar and random image avatar
License MIT
Informations about the package avatar
Here’s a complete README.md
file with all the content grouped together:
bash composer require mmnijas/avatar `
Requirements
- PHP 7.2 or higher
- Intervention Image library
You can install the Intervention Image library via Composer:
Usage
Route Definition
First, you need to define a route for generating avatars in your web.php
file:
Controller Function
In your controller (e.g., AvatarController
), add the following function:
Displaying the Avatar
You can generate and display an avatar image in your Blade view using the following code:
Customization Options
You can customize the avatar by passing additional parameters:
- name: The full name from which initials will be extracted (default is "John Doe").
- size: The size of the avatar image in pixels (default is 200).
- bg: Background color in hexadecimal format (optional).
- color: Text color in hexadecimal format (optional).
Example with Customization
Example Code
Here’s a complete example of how to set everything up:
-
Define Route in
web.php
: -
Controller Function in
AvatarController
: - Display Avatar in your Blade view:
License
This package is open-source software licensed under the MIT License.
Contributing
If you would like to contribute to this package, feel free to submit a pull request or open an issue.
Acknowledgments
Thanks to the Intervention Image library for providing the tools to manipulate images easily.
composer require mmnijas/avatar
use App\Http\Controllers\TestController;
Route::get('/avatar', [TestController::class, 'generateAvatar'])->name('avatar');
All versions of avatar with dependencies
illuminate/support Version ^10.0|^11.0
illuminate/cache Version ^10.0|^11.0
intervention/image Version ^2.7