Download the PHP package ridwanpr/string-masker without Composer
On this page you can find all versions of the php package ridwanpr/string-masker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ridwanpr/string-masker
More information about ridwanpr/string-masker
Files in ridwanpr/string-masker
Package string-masker
Short Description A php library for masking sensitive data (e.g., credit card numbers, emails, etc.) based on specific patterns.
License MIT
Informations about the package string-masker
String Masker
A php library for masking sensitive data (e.g., credit card numbers, emails, etc.) based on specific patterns.
Features
- Customizable Masking Patterns: Easily configure how text should be masked (e.g., showing last 4 digits of a credit card, obfuscating email domains).
- Support for Various Data: Works with different types of text, such as emails, passwords, phone numbers, and more.
- Locale-aware Formatting: Supports formatting for phone numbers based on locale.
- Mask Specific Words or Phrases: Mask out specific words or phrases in a text.
Installation
You can install this package via Composer. Run the following command in your terminal:
Usage
Email Masker
The EmailMasker
class allows you to mask parts of an email address.
Options:
local
: An associative array to specify how to mask the local part of the email.mask
: Character to use for masking (default: '*').start
: Starting position to begin masking (default: 0).length
: Number of characters to mask (default: 1).
domain
: An associative array to specify how to mask the domain part of the email.mask
: Character to use for masking (default: '*').start
: Starting position to begin masking (default: 0).length
: Number of characters to mask (default: 1).
maskAll
: Can be set to 'local', 'domain', or 'both' to mask the entire local or domain part.
Credit Card Masker
The CreditCardMasker
class is used to mask credit card numbers.
Options:
mask
: Character to use for masking (default: '*').maskAll
: Set to true to mask the entire credit card number.positions
: Array of positions to mask.showDashes
: Set to true to display dashes for readability.
Phone Masker
The PhoneMasker
class can mask phone numbers based on specified rules.
Options:
mask
: Character to use for masking (default: '*').maskAll
: Set to true to mask the entire phone number.positions
: Array of positions to mask.
Text Masker
The TextMasker
class masks specified positions in a given text based on specified rules.
Options:
mask
: Character to use for masking (default: '*').maskAll
: Set to true to mask the entire text.positions
: Array of positions to mask.separators
: Array of characters to maintain as separators (e.g., spaces, commas).
Content Masker
The ContentMasker
class masks specific words or phrases in a text.
Options:
mask
: Character to use for masking (default: '*').words
: Array of words or phrases to mask in the text.
License
This library is open-source software licensed under the MIT License.