jeroen-g/textconveyor

Send any text over a conveyor to format it.

1.1 2018-04-26 19:39 UTC

This package is auto-updated.

Last update: 2024-10-25 08:10:03 UTC


README

Latest Version on Packagist Build Status StyleCI

The TextConveyor takes your text, whatever size, and runs it through a list of formatters that is defined by you.

Installation

Via Composer

$ composer require jeroen-g/textconveyor

In case you're using Laravel, a service provider and facade get registered automatically. With artisan vendor:publish you can alter the formatters that get set in the config file.

Usage

$assembler = new JeroenG\TextConveyor\Assembler;
$assembler->setFormatters([App\RemoveBadWords::class, App\LowercaseNames::class]);
$assembler->addFormatter(App\CapitalizeNames::class);
$assembler->removeFormatter(App\LowercaseNames::class);
$formattedText = $assembler->sendContentThroughFormatters($content);

This is how it could be used in an Eloquent model:

public function getBodyAttribute($body)
{
    return app(JeroenG\TextConveyor\Assembler::class)->sendContentThroughFormatters($body);
}

Change log

Please see the changelog for more information on what has changed recently.

Contributing

Please see contributing.md for details and a todolist.

License

license. Please see the license file for more information.