wyattcast44 / laravel-safe-username
Laravel vulgar username filter / validation rule.
Installs: 1 165
Dependents: 0
Suggesters: 0
Security: 0
Stars: 23
Watchers: 4
Forks: 1
Open Issues: 0
Requires
- php: ^8.2
- illuminate/contracts: ^10.0||^11.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^2.9
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^9.0.0||^8.22.0
- pestphp/pest: ^2.34
- pestphp/pest-plugin-arch: ^2.7
- pestphp/pest-plugin-drift: ^2.6
- pestphp/pest-plugin-laravel: ^2.3
- rector/rector: ^1.2
README
This is a small package to help you easily validate usernames against a list of
commonly banned usernames, for example: json
, admin
, security
, etc. You
can also add your own custom allowed and disallowed usernames.
You can see the full list of disallowed usernames in the config file, or the source repo from which the list came from.
Installation
You can install the package via composer:
composer require wyattcast44/laravel-safe-username
Usage
use Wyattcast44\SafeUsername\Rules\AllowedUsername; Validator::make($request, [ 'username' => ['required', 'string', new AllowedUsername], ]);
Configuration
You can publish the configuration file with the command below. This will publish a config file called safe-username.php
.
php artisan vendor:publish --provider="Wyattcast44\SafeUsername\SafeUsernameServiceProvider"
Once you have published the config file you can add additional usernames to disallow, or add usernames that should pass the validation.
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email wyatt.castaneda@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
Laravel Package Boilerplate
This package was generated using the Laravel Package Boilerplate.