PHPackages                             codulab/restricted - 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. [Security](/categories/security)
4. /
5. codulab/restricted

ActiveLibrary[Security](/categories/security)

codulab/restricted
==================

Restricts registration when a user's input (eg: username) matches a list of restricted words

v1.0.4(8y ago)13663MITPHPPHP ~5.6|~7.0

Since Dec 3Pushed 8y ago4 watchersCompare

[ Source](https://github.com/Codulab/laravel-restricted)[ Packagist](https://packagist.org/packages/codulab/restricted)[ RSS](/packages/codulab-restricted/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)DependenciesVersions (7)Used By (0)

Restricted
==========

[](#restricted)

Restricted allows you to restrict your users from signing up with reserved words.

Reserved words can be:

1. Your route segments - Example, you have this route: [www.mywebsite.com/login](http://www.mywebsite.com/login)and your application allows to view user profile like this: [www.mywebsite.com/username](http://www.mywebsite.com/username)This package can crawl all your routes and return a validation message when a user tries to register with such words like "login"
2. Words you just want to reserve - Example: cart, products, admin etc. These words can be added manually to the reserved.txt file. after running the "restricted:index" command.

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

[](#installation)

To install Restricted use composer

### Download

[](#download)

```
composer require codulab/restricted

```

### Add service provider

[](#add-service-provider)

Add the following service provider to the array in: `config/app.php`

```
Codulab\Restricted\RestrictedServiceProvider::class,
```

### Publish the config

[](#publish-the-config)

```
php artisan vendor:publish --tag=restricted_config

```

Usage
-----

[](#usage)

First, we need to crawl and index the application routes by running the command:

```
php artisan restricted:index

```

Now, you can simply add restricted to your validations like so:

```
    $this->validate($request, [
        'name' => 'required|string|min:5',
        'username' => 'required|restricted'
    ]);
```

You can also add a new validation message

```
    $this->validate($request, [
        'name' => 'required|string|min:5',
        'username' => 'required|restricted'
    ],[
    	'username.restricted' => 'A user exists with that username. Please try another or add more characters'
    ]);
```

Settings
--------

[](#settings)

- file\_path: (string) File name and path to save the indexed words
- index\_level: (int) How deep do u want us to crawl your routes? ExAMPLE =&gt; [www.mywebsite.com/segment1/segmen2/segment3](http://www.mywebsite.com/segment1/segmen2/segment3). setting this value to '2', will allow indexing of segment1 and segment2 and exclude segment3
- merge: (bool) should we to merge the new results with the old ones

License
-------

[](#license)

MIT license - free to use and abuse!

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 82.8% 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

Every ~109 days

Total

5

Last Release

3009d ago

### Community

Maintainers

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

---

Top Contributors

[![Godofbrowser](https://avatars.githubusercontent.com/u/20337551?v=4)](https://github.com/Godofbrowser "Godofbrowser (24 commits)")[![stanwarri](https://avatars.githubusercontent.com/u/1219663?v=4)](https://github.com/stanwarri "stanwarri (4 commits)")[![scrapewww](https://avatars.githubusercontent.com/u/30661012?v=4)](https://github.com/scrapewww "scrapewww (1 commits)")

---

Tags

securityusernamerestricted

### Embed Badge

![Health badge](/badges/codulab-restricted/health.svg)

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

###  Alternatives

[phpseclib/phpseclib

PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.

5.6k434.8M1.3k](/packages/phpseclib-phpseclib)[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M212](/packages/defuse-php-encryption)[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k16.7M112](/packages/mews-purifier)[robrichards/xmlseclibs

A PHP library for XML Security

41278.1M118](/packages/robrichards-xmlseclibs)[voku/anti-xss

anti xss-library

72317.1M76](/packages/voku-anti-xss)[spatie/laravel-csp

Add CSP headers to the responses of a Laravel app

8519.6M19](/packages/spatie-laravel-csp)

PHPackages © 2026

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