Skip to content

PHP Prepositioner for replacing prepositions with   after preposition

Notifications You must be signed in to change notification settings

tomaj/prepositioner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prepositioner

PHP Prepositioner for replacing prepositions with   after preposition

Code Climate Test Coverage Latest Stable Version License

Instalation

Install package via composer:

$ composer require tomaj/prepositioner

Usage

Simple usage without Factory is very simple:

$prepositioner = new Tomaj\Prepositioner\Prepositioner(['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.

Upgrade

From version 2 to 3

  • Minimum php version is 7.3 from now
  • If you are using custom Language file from otside or from this repository (and don't use Tomaj\Prepositioner\Factory) you have to change namespace from \Tomaj\Prepositioner\MyLanguage to \Tomaj\Prepositioner\Language\MyLanguage
  • Note: new version includes declare(strict_types=1); in all files

Known issue

  1. each new language has to be in Tomaj\Prepositioner\Language namespace if you would like to use Factory

About

PHP Prepositioner for replacing prepositions with   after preposition

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages