2017 © Pedro Peláez
 

library php-initials

A package to generate initials in PHP

image

lasserafn/php-initials

A package to generate initials in PHP

  • Friday, October 13, 2017
  • by lasserafn
  • Repository
  • 2 Watchers
  • 9 Stars
  • 18,711 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 9 Versions
  • 29 % Grown

The README.md

Generate initials from names

This is the core of LasseRafn/php-initial-avatar-generator, or well.. the initials generation part of it., (*1)

It's framework agnostic, which is different from basically everything else I do, you're welcome., (*2)

Supports UTF8 (yes, also emojis.), (*3)

Code Coverage StyleCI Status Total Downloads Latest Stable Version License , (*4)

Installation

You just require using composer and you're good to go!, (*5)

composer require lasserafn/php-initials

Usage

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

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

All you'll have to do is either pass in the name in the constructor like so:, (*7)

echo new Initials('The Name Here'); // TH

or use the name($name) method, to specify the name., (*8)

Supported methods

name($name = 'John Doe')

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

length($length = 2)

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

generate()

This method will output the initials. It's completely optional, you could also just echo out the class as it has a __toString() method., (*9)

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

getUrlfriendlyInitials()

Will output url-friendly initials (stripping characters like ÆØÅ), (*10)

Requirements

  • PHP 5.6, 7.0 or 7.1

The Versions

13/10 2017

dev-master

9999999-dev

A package to generate initials in PHP

  Sources   Download

MIT

The Requires

  • php ^5.6|^7.0|^7.1

 

The Development Requires

php initials

13/10 2017

v2.20

2.20.0.0

A package to generate initials in PHP

  Sources   Download

MIT

The Requires

  • php ^5.6|^7.0|^7.1

 

The Development Requires

php initials

13/10 2017

v2.2

2.2.0.0

A package to generate initials in PHP

  Sources   Download

MIT

The Requires

  • php ^5.6|^7.0|^7.1

 

The Development Requires

php initials

14/06 2017

v2.16

2.16.0.0

A package to generate initials in PHP

  Sources   Download

MIT

The Requires

  • php ^5.6|^7.0|^7.1

 

The Development Requires

php initials

30/05 2017

v2.15

2.15.0.0

A package to generate initials in PHP

  Sources   Download

MIT

The Requires

  • php ^7.0|^7.1

 

The Development Requires

php initials

30/05 2017

v2.1

2.1.0.0

A package to generate initials in PHP

  Sources   Download

MIT

The Requires

  • php ^7.0|^7.1

 

The Development Requires

php initials

14/02 2017

v2.0

2.0.0.0

A package to generate initials in PHP

  Sources   Download

MIT

The Requires

  • php ^7.0|^7.1

 

The Development Requires

php initials

14/02 2017

v1.9

1.9.0.0

A package to generate initials in PHP

  Sources   Download

MIT

The Requires

  • php ^7.0|^7.1

 

The Development Requires

php initials

14/02 2017

dev-analysis-zYRMvA

dev-analysis-zYRMvA

A package to generate initials in PHP

  Sources   Download

MIT

The Requires

  • php ^7.0|^7.1

 

The Development Requires

php initials