Download the PHP package murilomagalhaes/masquerade without Composer
On this page you can find all versions of the php package murilomagalhaes/masquerade. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download murilomagalhaes/masquerade
More information about murilomagalhaes/masquerade
Files in murilomagalhaes/masquerade
Package masquerade
Short Description Masquearde is a library with a handful of methods to help you work with text manipulation.
License MIT
Informations about the package masquerade
🦝 Masquerade A PHP Text Manipulation Library
Clique aqui caso queira acessar a versão em Português deste arquivo! 🇵🇹 🇧🇷
Masquerade is a library with a handful of methods to help you work with text manipulation, so you (hopefully) don't need to google regex expressions for the thousandth time. It is intended to manipulate short strings such as form inputs and alike, even providing masking/formatting methods.
Requirements
PHP: ^7.4|8.*
Composer
Instalation
composer require murilomagalhaes/masquerade
Usage
-
Once the package is installed, call it on your working file.
- Use the
set()
method to start chaining filters, masks, and/or whatever other methods available
Examples
-
Filtering
-
Masking | Formatting
-
Custom methods (Macros)
- Getters
Available Methods
Method Signature | Description |
---|---|
set(string $text): Masquerade |
Creates a new Masquerade instance, and defines the text string to be used by the chained methods. |
only(...$filter_types): Masquerade |
Keeps only the character types defined on the $filter_types parameter. Available types: 'letters' , 'numbers' , 'punctuation' and 'whitespaces' The following characters are understood as punctuation , . : ; ? ¿ ! ¡ - |
ignore(... $character) |
The defined characters won't be removed by the only() . Must be called BEFORE the only() method to take effect |
strip(...$characters): Masquerade |
Removes the defined characters from the text string |
between(string $before, string $after): Masquerade |
Keeps only the characters between the $before and $after parameters; |
removeAccents(): Masquerade |
Removes all character's accents. (acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml|) |
mask(string $pattern): Masquerade |
Applies the defined pattern to the text string |
format(string $pattern): Masquerade |
Alias to the mask method |
trim(): Masquerade |
Removes trailing and multiple spaces/tabs from the text string (Method always aplied on class __toString() and getText() methods) |
static::macro(string $name, callable $callback): void |
Defines a macro/custom method |
getText(): string |
Returns the text string |
getOriginalText(): string |
Returns the text string on it's original state |
getUnmaskedText(): string |
Returns the text string before maskking |