Download the PHP package aliziodev/laravel-username-guards without Composer
On this page you can find all versions of the php package aliziodev/laravel-username-guards. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download aliziodev/laravel-username-guards
More information about aliziodev/laravel-username-guards
Files in aliziodev/laravel-username-guards
Package laravel-username-guards
Short Description A comprehensive username filtering package for Laravel that helps filter profanity, adult content, illegal activities, gambling, spam, and religion abuse words
License MIT
Informations about the package laravel-username-guards
Laravel Username Guards
Laravel Username Guards is a comprehensive package for validating usernames in Laravel applications. It provides robust validation features including pattern matching and prohibited word filtering across multiple languages.
Features
- Pattern-based username validation (length, allowed characters, format)
- Prohibited word filtering in multiple categories (profanity, adult, spam, etc.)
- Multi-language support (en, id, and extendable)
- Flexible configuration
- Easy integration with Laravel Validation
- Facade for direct usage
- Caching for better performance
Installation
Install the package via Composer:
Console Commands
This command:
- Publishes configuration file
- Publishes word resources
- Sets up basic configuration
Cache Clearing Command:
This command clears all caches related to the package:
- Configuration cache
- Application cache
- Package discovery cache
Configuration
After publishing the configuration file, you can customize various options in config/username-guard.php :
Language Settings
Filtering Mode
Word Categories
Validation Patterns
Cache Settings
Usage
Using Validation Rule
The easiest way to use this package is with the UsernameRule in Laravel validation:
Then use the form request in your controller:
Using Facade
You can also use the Username facade for direct validation:
Using Service Directly
For more control, you can use the UsernameService directly:
Adding Custom Categories
To add custom prohibited word categories:
-
Add the category in configuration:
-
Create directory structure and word files:
- Fill the files with arrays of prohibited words:
Handling Errors
When validation fails, you can get error information:
Customizing Error Messages
You can customize error messages when using UsernameRule :
License
This package is licensed under the MIT License.
Contributing
Contributions are welcome! Please create issues or pull requests on the GitHub repository.
All versions of laravel-username-guards with dependencies
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/console Version ^10.0|^11.0|^12.0
illuminate/validation Version ^10.0|^11.0|^12.0
illuminate/translation Version ^10.0|^11.0|^12.0
illuminate/contracts Version ^10.0|^11.0|^12.0