This is the core of LasseRafn/php-initial-avatar-generator, or well.. the initials generation part of it.
It's framework agnostic, which is different from basically everything else I do, you're welcome.
Supports UTF8 (yes.. also emojis.)
You just require using composer and you're good to go!
composer require lasserafn/php-initials
Rad, and long, package name.. huh? Sorry. I'm not very good with names.
As with installation, usage is quite simple. Generating a image is done by running:
echo (string) (new LasseRafn\Initials\Initials('Lasse Rafn')); // Output: LR echo (new LasseRafn\Initials\Initials)->name('Justine Bieber')->generate(); // Output: JB echo (new LasseRafn\Initials\Initials('John Christian Doe'))->generate(); // Output: JD echo (new LasseRafn\Initials\Initials)->generate('Leonardo'); // Output: LE echo (new LasseRafn\Initials\Initials)->length(1)->generate('Camilla'); // Output: C
$initials->name('Albert Magnum')->generate();
$initials->name('Albert Magnum')->length(3)->generate();
- PHP 7.0 or 7.1