Skip to content

LasseRafn/php-initials

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Generate initials from names

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.)

Build Status Coverage StyleCI Status Total Downloads Latest Stable Version License

Installation

You just require using composer and you're good to go!

composer require lasserafn/php-initials

Usage

As with installation, usage is quite simple. Generating a image is done by running:

use LasseRafn\Initials\Initials; echo (new Initials('Lasse Rafn')); // Output: LR echo (new Initials)->name('Justine Bieber')->generate(); // Output: JB echo (new Initials('John Christian Doe'))->generate(); // Output: JD echo (new Initials)->generate('Leonardo'); // Output: LE echo (new Initials)->length(1)->generate('Camilla'); // Output: C echo (new Initials)->name('Jens Ølsted')->getUrlfriendlyInitials(); // Output: JO

Supported methods and parameters

Name (initials) - default: JD

$initials->name('Albert Magnum')->generate();

Length - default: 2

$initials->name('Albert Magnum')->length(3)->generate();

Requirements

  • PHP 5.6, 7.0 or 7.1

About

Library to generate initials from a full name. PHP 5.6+

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages