derrikeg/mute8

There is no license information available for the latest version (dev-master) of this package.

A text mutator that should permit random mutations.

dev-master 2017-10-23 17:46 UTC

This package is not auto-updated.

Last update: 2024-04-14 01:52:05 UTC


README

Mutate strings using the magic of PHP. The project was designed such that an RNG could make its own selections and apply multiple "mutations" to text. In order to allow picking parts, Selectors make a string more workable by specifying which regions in a substring should be modified. Mutators then take those regions and perform transformations either by modifying, replacing, or adding to the whole or parts of a selection. By breaking it up into these two techniques it becomes a bit easier to apply partial filters to existing text and stack mutations.

Download

Mute8 is also available on packagist to include in your composer.json.

Usage

After downloading the package and installing it (generating its autoloader), you should be able to do the following:

use DerrikeG\Mute8\Mutators\Custom\UpperCase;
use DerrikeG\Mute8\Selectors\Words\FirstWord;

$selector = new FirstWord("birds love noodles!");
$mutator = new UpperCase($selector);

$results = $mutator->mutate();
echo $results;

Should produce: "BIRDS love noodles!"

Extending

Everything is either a Mutator or a Selector, to make a new one you can either extend the base classes or one of their sub-types. (mutator, selector)

Demo Results

Demo Example Demo Closeup