tomaj/prepositioner

Preposition replace library

Installs: 1 475

Dependents: 0

Stars: 3

Watches: 2

Open Issues: 1

Language: PHP

1.1.3 2014-07-25 18:04 UTC

README

PHP Prepositioner for replacing prepositions with   after preposition

Build Status Code Climate Coverage Status Dependency Status

Latest Stable Version Latest Unstable Version License

Instalation

Install package via composer:

$ composer require tomaj/prepositioner

Usage

Simple usage without Factory is very simple:

$prepositioner = new Tomaj\Prepositioner\Prepositioner(array('one', 'two'));
$prepositioner->formatText($inputText);

This example replaces all occurences of 'one' or 'two' strings in $inputText as 'one ' and 'two '.

For using with Factory which contains language support try:

$prepositioner = Tomaj\Prepositioner\Factory::build('slovak')
$prepositioner->formatText($inputText);

Extending

For new language support you need to implement new language class which implements LanguageInterface with prepositions. See SlovakLanguage for details.

Known issue

  1. each new language has to be in Tomaj\Prepositioner namespace