PHPackages                             quebecstudio/safename - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. quebecstudio/safename

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

quebecstudio/safename
=====================

Laravel validation rule to protect against reserved usernames and words

1.0.0(1y ago)02MITPHPPHP ^8.2

Since Jan 22Pushed 1y agoCompare

[ Source](https://github.com/quebecstudio/safename)[ Packagist](https://packagist.org/packages/quebecstudio/safename)[ RSS](/packages/quebecstudio-safename/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (8)Versions (2)Used By (0)

Laravel SafeName
================

[](#laravel-safename)

A Laravel validation package to prevent the use of reserved words in usernames or other fields.

Support for Ukraine and Call for Solidarity 🇺🇦
----------------------------------------------

[](#support-for-ukraine-and-call-for-solidarity-)

Québec Studio supports Ukraine and its people in their quest for peace, freedom, and sovereignty.

If you do not support the Ukrainian people in this unjust war they never wanted, we kindly ask you not to use our software, as it is intended for those who wish to be on the right side of history.

Features
--------

[](#features)

- Exact word matching (e.g., `admin` would block only `admin`)
- Partial word matching (e.g., `admin` would block `administrator`, `superadmin`, etc.)
- Multilingual support (English and French included)
- Configurable reserved word lists
- Support for Laravel 11.x

Installation
------------

[](#installation)

```
composer require quebecstudio/safename
```

Configuration
-------------

[](#configuration)

Publish the config and translation files:

```
php artisan vendor:publish --tag="safename"
```

### Reserved Words Configuration

[](#reserved-words-configuration)

Edit `config/safename.php` to customize your reserved words:

```
return [
    'exact' => [
        'admin',
        'root',
        // ...
    ],
    'partial' => [
        'admin',    // Will block 'administrator', 'superadmin', etc.
        'super',    // Will block 'superuser', 'superman', etc.
        // ...
    ]
];
```

Usage
-----

[](#usage)

### Using the Rule Object

[](#using-the-rule-object)

```
use Quebecstudio\SafeName\Rules\SafeName;

$request->validate([
    'username' => ['required', new SafeName()]
]);
```

### Using the Rule String

[](#using-the-rule-string)

```
$request->validate([
    'username' => 'required|safe_name'
]);
```

### Command Line Validation

[](#command-line-validation)

The package includes an artisan command to test usernames:

```
php artisan validate:username
```

Translations
------------

[](#translations)

The package includes English and French translations. You can override them by publishing the language files and editing them in `lang/vendor/safename/`.

Testing
-------

[](#testing)

```
composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance44

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

481d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fdc7969a41fb84195b9678d5dd784bd182c40e367b96a1cc191057640786bfc1?d=identicon)[rtrudel](/maintainers/rtrudel)

---

Top Contributors

[![rtrudel](https://avatars.githubusercontent.com/u/18495095?v=4)](https://github.com/rtrudel "rtrudel (3 commits)")

###  Code Quality

TestsPest

Static AnalysisRector

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/quebecstudio-safename/health.svg)

```
[![Health](https://phpackages.com/badges/quebecstudio-safename/health.svg)](https://phpackages.com/packages/quebecstudio-safename)
```

###  Alternatives

[propaganistas/laravel-phone

Adds phone number functionality to Laravel based on Google's libphonenumber API.

3.0k35.7M107](/packages/propaganistas-laravel-phone)[spatie/laravel-honeypot

Preventing spam submitted through forms

1.6k6.0M60](/packages/spatie-laravel-honeypot)[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[illuminate/validation

The Illuminate Validation package.

18936.7M1.4k](/packages/illuminate-validation)[axlon/laravel-postal-code-validation

Worldwide postal code validation for Laravel and Lumen

3853.3M1](/packages/axlon-laravel-postal-code-validation)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
