repat/censor-text

Help search and replace specific texts, such as email address(es).

0.1 2019-05-19 12:03 UTC

README

Latest Version on Packagist Total Downloads

censor-text is a package to help search and replace specific texts, such as email address(es).

Installation

$ composer require repat/censor-text

Documentation

// Init
$text = new \Repat\Text();

// With Setter
$text->setText('My email address is foobar@example.com');
$text->censorEmail();
// returns: 'My email address is ******************'

// Chain
$text->setText('My email address is foobar@example.com')->censorEmail();

// In Constructor
$text = new \Repat\Text('My email address is foobar@example.com');

// Exchange censoring character
$text->censorEmail("");
// returns: My email address is ❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚

// Laravel
$text = resolve(\Repat\Text::class);
$text->setText('My email address is foobar@example.com')->censorEmail();

// Helper function
censor_email('My email address is foobar@example.com');
censor_email('My email address is foobar@example.com', "");

License

Version

  • Version 0.1

Contact

repat

Flattr this git repo