Download the PHP package irabbi360/laravel-attribute-mask without Composer
On this page you can find all versions of the php package irabbi360/laravel-attribute-mask. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download irabbi360/laravel-attribute-mask
More information about irabbi360/laravel-attribute-mask
Files in irabbi360/laravel-attribute-mask
Package laravel-attribute-mask
Short Description Mask Eloquent attributes on retrieval like $casts
License MIT
Homepage https://github.com/irabbi360/laravel-attribute-mask
Informations about the package laravel-attribute-mask
Mask Eloquent Attributes on Retrieval
A Laravel package that automatically masks sensitive model attributes on retrieval. Supports email, phone, and text masking with highly configurable rules.
Features
- Automatic attribute masking on retrieval
- Email, phone, and text masking support
- Configurable mask character and visibility
- Global or per-attribute masking rules
- Auto-detection of phone fields by column name
Installation
Publish the config file:
Configuration
The default configuration (config/attribute-mask.php):
Usage
Define Maskable Attributes
Add the HasMaskedAttributes trait and define maskable attributes using the maskables() method:
Alternatively, use the $maskable property:
Masking Behavior
Attributes are automatically masked on retrieval:
Retrieving Original Values
Get the unmasked value using getOriginal():
Or temporarily disable masking:
Email Masking
Configure email masking behavior:
Examples:
Phone Masking
Phone fields are auto-detected by column name. Configure visibility:
Examples:
1234567890→123****90+1-555-123-4567→+15-***-67
Add custom phone patterns:
Text Masking
For other text attributes:
Examples:
secretpassword→sec********rdAPI_KEY_12345→API***345
Custom Mask Character
Change the mask character globally:
Disable Masking
Disable globally:
Or temporarily:
Testing
Changelog
See CHANGELOG.md for details on updates.
Contributing
See CONTRIBUTING.md for contribution guidelines.
Security
Report security vulnerabilities via Security Policy.
Credits
- Fazle Rabbi
- All Contributors
License
The MIT License. See LICENSE.md for details.
All versions of laravel-attribute-mask with dependencies
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^10.0 | ^11.0 | ^12.0