PHP code example of lukaswhite / capitalizer

1. Go to this page and download the library: Download lukaswhite/capitalizer 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/ */

    

lukaswhite / capitalizer example snippets


use Lukaswhite\Capitalizer\Capitalizer;
$capitalizer = new Capitalizer();

print $capitalizer->title('to be or not to be'); // prints To Be or Not to Be

print $capitalizer->name('RAJIV VAN LA PARRA'); // prints Rajiv van La Parra

print $capitalizer->place('STOKE ON TRENT'); // prints Stoke on Trent

print $capitalizer->title('this is a string); // prints This is a String

$capitalizer = new Capitalizer();

$capitalizer->addLowercase('con'); // e.g. Chilli con Carne

$capitalizer->addUppercase('php'); // good for acronyms

$capitalizer->addLowercaseName('of'); // only applies to names; e.g. Jesus of Nazareth

$capitalizer->addPrefix('Mc');

$capitalizer->addSuffix('\'s');

$capitalizer = new Capitalizer();

$capitalizer->addLowercase('con')
    ->addUppercase('php')
    ->addLowercaseName('of')
    ->addPrefix('Mc')
    ->addSuffix('\'s');