wyattcast44/laravel-safe-username

Laravel vulgar username filter / validation rule.

5.0.0 2024-09-30 03:47 UTC

This package is auto-updated.

Last update: 2024-11-30 04:15:44 UTC


README

Latest Version on Packagist Total Downloads

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.