PHP code example of lasserafn / php-initials

1. Go to this page and download the library: Download lasserafn/php-initials library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lasserafn / php-initials example snippets


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

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

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

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

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