1. Go to this page and download the library: Download tamtamchik/namecase 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/ */
tamtamchik / namecase example snippets
use \Tamtamchik\NameCase\Formatter;
use function \Tamtamchik\NameCase\str_name_case;
// As a static call
Formatter::nameCase("KEITH"); // => Keith
Formatter::nameCase("LEIGH-WILLIAMS"); // => Leigh-Williams
Formatter::nameCase("MCCARTHY"); // => McCarthy
Formatter::nameCase("O'CALLAGHAN"); // => O'Callaghan
Formatter::nameCase("ST. JOHN"); // => St. John
Formatter::nameCase("VON STREIT"); // => von Streit
Formatter::nameCase("AP LLWYD DAFYDD"); // => ap Llwyd Dafydd
Formatter::nameCase("HENRY VIII"); // => Henry VIII
Formatter::nameCase("VAN DYKE"); // => van Dyke
// Or as an instance
$formatter = new Formatter();
$formatter->nameCase("LOUIS XIV"); // => Louis XIV
// Or as a function
str_name_case("JJ ABRAMS"); // => JJ Abrams
// Passing options (see below for details)
Formatter::setOptions([
'lazy' => true,
'irish' => true,
'spanish' => false,
'roman' => true,
'hebrew' => true,
'postnominal' => true,
]);
// Or
$formatter = new Formatter(['spanish' => true]);
// Or
$formatter->setOptions([
'lazy' = false,
'postnominal' => false
]);
// Or even
Formatter::nameCase("VAN DYKE", ['lazy' = false]);
// And for function
str_name_case("VAN DYKE", ['lazy' = false]);
use Tamtamchik\NameCase\Formatter;
Formatter::excludePostNominals('MOst');
Formatter::nameCase('ČERNÝ MOST');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.