Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Php Initial Avatar Generator Laravel Package

lasserafn/php-initial-avatar-generator

Generate initial-based avatar images in PHP. Create colorful letter avatars (e.g., user initials) for profiles and placeholders, with configurable size, font, colors, and shapes. Lightweight, framework-agnostic, easy to integrate in any app.

View on GitHub
Deep Wiki
Context7
4.4

What's Changed

New Contributors

Full Changelog: https://github.com/LasseRafn/php-initial-avatar-generator/compare/4.3...4.4

4.2.1
4.2.0
4.1.2
4.1.1
4.1.0
4.0.2
3.0.3
3.0.1

Cleaned up the base and tests. Added support for switching driver from GD to Imagick, and back.

Removed caching method entirely.

This is considered a minor BC because of parameter renaming.

fixed 3.0.0 bug.

2.3.0
  • private => protected visibility
  • FontAwesome v5 support
  • Removed cache
2.2.2
2.1.1
2.1.0

Can now detect language/script and apply a font that supports that script/language.

Supported:

  • Arabic
  • Armenian
  • Bengali
  • Georgian
  • Hebrew
  • Mongolian
  • Thai
  • Tibetan

More will come, when more supporting fonts are found.

2.0.8

Will now NOT default to __DIR__ . $fontFile but instead use it as a fallback.

This also means you can specify in an integer for GD Internal fonts or a complete path. Current implementations should still work, as it will simply fallback to the old implementation if no font is found.

2.0.7

I found a way to solve the ugly circle when using rounded(). Now, by using smooth() as well, it will generate a avatar at 5x size (without text) and resize back after the circle has been created. Example below:

Before: download 2

After: download 1

As you can see, the text is unchanged but the circle is far smoother. Use this and supply a avatar double the size of the img tag, and you will get some crisp avatars. 👍

Double size of img tag:

Smooth + double size of img tag:

v2.0.6

After seeing https://github.com/sybri/php56-initial-avatar-generator, I decided to add php 5.6 support. Thanks!

v2.0.5

It's now possible to use Japanese letters, with a different font.

<?php

require_once 'vendor/autoload.php';

$avatar = new LasseRafn\InitialAvatarGenerator\InitialAvatar();

echo $avatar->font('/fonts/NotoSans-Medium.otf')
            ->generate('こんにちは')
            ->stream('data-url');
v2.0
v1.2

Can now generate rounded images, however you should default to using border-radius using CSS instead.

v1.1

I've fixed some stuff, added some docblocks, written more tests and setup monitoring and more.

v1.0

Aaaaand we're up! 🎉

v0.6.5

Font sizes are a percentage of the image size. Example: 0.5 = 50% of image size.

v0.6

Lets say you want to have single letter initials, or maybe even three letters? Well thats possible!

$avatar->name('Michael Burbon Hansen')->length(3)->generate(); // MBH
v0.5
v0.1.7
v0.1.6
v0.1.5
v0.1
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log