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

27

—

LowBetter than 47% of packages

Maintenance41

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

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

526d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/18495095?v=4)[Richard Trudel](/maintainers/rtrudel)[@rtrudel](https://github.com/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

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k95.4M304](/packages/laravel-horizon)[illuminate/validation

The Illuminate Validation package.

18838.2M1.7k](/packages/illuminate-validation)[illuminate/database

The Illuminate Database package.

2.8k54.9M11.6k](/packages/illuminate-database)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M194](/packages/laravel-ai)[moonshine/moonshine

Laravel administration panel

1.3k253.1k81](/packages/moonshine-moonshine)

PHPackages © 2026

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