PHP code example of brightfish / bf-text-formatter

1. Go to this page and download the library: Download brightfish/bf-text-formatter 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/ */

    

brightfish / bf-text-formatter example snippets


// generic text formatter
use Brightfish\TextFormatter\BaseFormatter;

$formatter = new BaseFormatter;
$formatter->uppercaseWords(['cia', 'fbi', 'nsa']);
$formatter->lowercaseWords(['in', 'a', 'the']);
$formatter->removeWords(['draft', 'void', 'obsolete']);
$result = $formatter->clean("The dog in the house"); // the Dog in the House

$formatter = (new BaseFormatter)->setForceTransliterate(true);

use Brightfish\TextFormatter\CampaignNameFormatter;

$formatter = new CampaignNameFormatter();

use Brightfish\TextFormatter\CinemaNameFormatter;

$formatter = new CinemaNameFormatter();
$result = $formatter->format("pathe charleroi");    // Pathé Charleroi

use Brightfish\TextFormatter\CompanyNameFormatter;

$formatter = new CompanyNameFormatter();

use Brightfish\TextFormatter\MovieTitleFormatter;

$formatter = new MovieTitleFormatter();

use Brightfish\TextFormatter\PersonNameFormatter;

$formatter = new PersonNameFormatter();

├── BaseFormatter.php
├── CampaignNameFormatter.php
├── CinemaNameFormatter.php
├── CompanyNameFormatter.php
├── CountryNameFormatter.php
├── MovieTitleFormatter.php
├── PersonNameFormatter.php
└── VatNumberFormatter.php