Skip to content

brightfish-be/BfTextFormatter

Repository files navigation

Format text the Brightfish way

Tests

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

Installation

You can install the package via composer:

composer require brightfish/bf-text-formatter

Usage

BaseFormatter

// 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);

CampaignNameFormatter

use Brightfish\TextFormatter\CampaignNameFormatter;

$formatter = new CampaignNameFormatter();

CinemaNameFormatter

use Brightfish\TextFormatter\CinemaNameFormatter;

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

CompanyNameFormatter

use Brightfish\TextFormatter\CompanyNameFormatter;

$formatter = new CompanyNameFormatter();

MovieTitleFormatter

use Brightfish\TextFormatter\MovieTitleFormatter;

$formatter = new MovieTitleFormatter();

PersonNameFormatter

use Brightfish\TextFormatter\PersonNameFormatter;

$formatter = new PersonNameFormatter();

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

Format things like movie titles, campaign names

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Contributors 2

  •  
  •  

Languages