PHPackages                             clarkeash/doorman - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. clarkeash/doorman

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

clarkeash/doorman
=================

v11.0.0(9mo ago)1.0k127.3k↓48.8%46[1 PRs](https://github.com/clarkeash/doorman/pulls)MITPHPPHP ^8.2CI failing

Since Apr 10Pushed 9mo ago15 watchersCompare

[ Source](https://github.com/clarkeash/doorman)[ Packagist](https://packagist.org/packages/clarkeash/doorman)[ RSS](/packages/clarkeash-doorman/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)Dependencies (5)Versions (26)Used By (0)

Doorman
=======

[](#doorman)

 [ ![GitHub Workflow Status](https://camo.githubusercontent.com/efce915bd6d291b5343090f4fb7272be4e5fc0c78fd0cd22ef9b1f4ba8275619/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f636c61726b656173682f646f6f726d616e2f74657374732e796d6c3f6c6f676f3d676974687562267374796c653d666f722d7468652d6261646765) ](https://github.com/clarkeash/doorman/actions?query=workflow%3ACI) [ ![](https://camo.githubusercontent.com/a82e4c46b86f2936100c4ecc9053fafe0f40daeeec1228cb48edf6e95aaf339a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f636c61726b656173682f646f6f726d616e2e7376673f7374796c653d666f722d7468652d6261646765) ](https://github.com/clarkeash/doorman/blob/master/LICENSE) [ ![GitHub release (latest SemVer)](https://camo.githubusercontent.com/674009a3c7c2ee8f0b3cfe11447711259ca5148da53a1502c3fd56dee3fb2814/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f636c61726b656173682f646f6f726d616e3f736f72743d73656d766572267374796c653d666f722d7468652d6261646765) ](https://packagist.org/packages/clarkeash/doorman) [ ![](https://camo.githubusercontent.com/6580610926d73cf577f4a13bd0e7f857c565213e7686eeb2760741254c12a100/687474703a2f2f696d672e736869656c64732e696f2f62616467652f617574686f722d40636c61726b656173682d626c75652e7376673f7374796c653d666f722d7468652d6261646765) ](https://twitter.com/clarkeash)

Doorman provides a way to limit access to your Laravel applications by using invite codes.

Invite Codes:

- Can be tied to a specific email address.
- Can be available to anyone (great for sharing on social media).
- Can have a limited number of uses or unlimited.
- Can have an expiry date, or never expire.

Laravel Support
---------------

[](#laravel-support)

LaravelDoorman5.x3.x6.x4.x7.x5.x8.x6.x9.x7.x10.x8.x11.x9.x12.x10.xInstallation
------------

[](#installation)

You can pull in the package using [composer](https://getcomposer.org):

```
composer require "clarkeash/doorman=^10.0"
```

Next, migrate the database:

```
php artisan migrate
```

Usage
-----

[](#usage)

### Generate Invites

[](#generate-invites)

Make a single generic invite code with 1 redemption, and no expiry.

```
Doorman::generate()->make();
```

Make 5 generic invite codes with 1 redemption each, and no expiry.

```
Doorman::generate()->times(5)->make();
```

Make an invite with 10 redemptions and no expiry.

```
Doorman::generate()->uses(10)->make();
```

Make an invite with unlimited redemptions and no expiry.

```
Doorman::generate()->unlimited()->make();
```

Make an invite that expires on a specific date.

```
$date = Carbon::now('UTC')->addDays(7);
Doorman::generate()->expiresOn($date)->make();
```

Make an invite that expires in 14 days.

```
Doorman::generate()->expiresIn(14)->make();
```

Make an invite for a specific person.

```
Doorman::generate()->for('me@ashleyclarke.me')->make();
```

Alternatively instead of calling `make()` which will return a collection of invites you can call `once()` if you only want a single invite generated.

```
$invite = Doorman::generate()->for('me@ashleyclarke.me')->once();
dd($invite->code);
```

### Redeem Invites

[](#redeem-invites)

You can redeem an invite by calling the `redeem` method. Providing the invite code and optionally an email address.

```
Doorman::redeem('ABCDE');
// or
Doorman::redeem('ABCDE', 'me@ashleyclarke.me');
```

If doorman is able to redeem the invite code it will increment the number of redemptions by 1, otherwise it will throw an exception.

- `InvalidInviteCode` is thrown if the code does not exist in the database.
- `ExpiredInviteCode` is thrown if an expiry date is set and it is in the past.
- `MaxUsesReached` is thrown if the invite code has already been used the maximum number of times.
- `NotYourInviteCode` is thrown if the email address for the invite does match the one provided during redemption, or one was not provided during redemption.

All of the above exceptions extend `DoormanException` so you can catch that exception if your application does not need to do anything specific for the above exceptions.

```
try {
    Doorman::redeem(request()->get('code'), request()->get('email'));
} catch (DoormanException $e) {
    return response()->json(['error' => $e->getMessage()], 422);
}
```

### Check Invites without redeeming them

[](#check-invites-without-redeeming-them)

You can check an invite by calling the `check` method. Providing the invite code and optionally an email address. (It has the same signature as the `redeem` method except it will return `true` or `false` instead of throwing an exception.

```
Doorman::check('ABCDE');
// or
Doorman::check('ABCDE', 'me@ashleyclarke.me');
```

### Change Error Messages (and translation support)

[](#change-error-messages-and-translation-support)

In order to change the error message returned from doorman, we need to publish the language files like so:

```
php artisan vendor:publish --tag=doorman-translations
```

The language files will then be in `/resources/lang/vendor/doorman/en` where you can edit the `messages.php` file, and these messages will be used by doorman. You can create support for other languages by creating extra folders with a `messages.php` file in the `/resources/lang/vendor/doorman` directory such as `de` where you could place your German translations. [Read the localisation docs for more info](https://laravel.com/docs/localization).

### Validation

[](#validation)

If you would perfer to validate an invite code before you attempt to redeem it or you are using [Form Requests](https://laravel.com/docs/5.4/validation#form-request-validation) then you can validate it like so:

```
public function store(Request $request)
{
    $this->validate($request, [
        'email' => 'required|email|unique:users',
        'code' => ['required', new DoormanRule($request->get('email'))],
    ]);

    // Add the user to the database.
}
```

You should pass the email address into the constructor to validate the code against that email. If you know the code can be used with any email, then you can leave the parameter empty.

### Config - change table name

[](#config---change-table-name)

First publish the package configuration:

```
php artisan vendor:publish --tag=doorman-config
```

In `config/doorman.php` you will see:

```
return [
    'invite_table_name' => 'invites',
];
```

If you change the table name and then run your migrations Doorman will then use the new table name.

Console
-------

[](#console)

### Cleanup

[](#cleanup)

To remove used and expired invites you can use the `cleanup` command:

```
php artisan doorman:cleanup
```

### Create a new invite

[](#create-a-new-invite)

You can create a new invite from the command line using the `make` command:

```
php artisan doorman:make
php artisan doorman:make --uses=5 --expiry=2025-12-31 --email=me@ashleyclarke.me
php artisan doorman:make --unlimited
```

###  Health Score

60

—

FairBetter than 98% of packages

Maintenance58

Moderate activity, may be stable

Popularity53

Moderate usage in the ecosystem

Community26

Small or concentrated contributor base

Maturity86

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 71.4% 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 ~140 days

Recently: every ~237 days

Total

23

Last Release

273d ago

Major Versions

v6.1.0 → v7.0.02022-02-12

v7.0.0 → 8.0.02023-02-25

8.0.0 → v9.0.02024-03-25

v9.0.0 → v10.0.02025-02-25

v10.1.0 → v11.0.02025-10-03

PHP version history (9 changes)v1.0.0PHP &gt;=7.0.0

v2.0.0PHP &gt;=7.1.3

v4.0.0PHP ^7.2

v5.0.0PHP ^7.2.5

v6.0.0PHP ^7.3

v6.1.0PHP ^7.3|^8.0

v7.0.0PHP ^8.0

8.0.0PHP ^8.1

v9.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/4aa56557de1c571ed78fb23fda585f3fd461425339df673fb293c609a6719c81?d=identicon)[clarkeash](/maintainers/clarkeash)

---

Top Contributors

[![clarkeash](https://avatars.githubusercontent.com/u/1612186?v=4)](https://github.com/clarkeash "clarkeash (135 commits)")[![SamuelNitsche](https://avatars.githubusercontent.com/u/24483576?v=4)](https://github.com/SamuelNitsche "SamuelNitsche (21 commits)")[![m1guelpf](https://avatars.githubusercontent.com/u/23558090?v=4)](https://github.com/m1guelpf "m1guelpf (10 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (9 commits)")[![vmiguellima](https://avatars.githubusercontent.com/u/33354683?v=4)](https://github.com/vmiguellima "vmiguellima (6 commits)")[![mikemand](https://avatars.githubusercontent.com/u/745184?v=4)](https://github.com/mikemand "mikemand (3 commits)")[![lucasdcrk](https://avatars.githubusercontent.com/u/17224437?v=4)](https://github.com/lucasdcrk "lucasdcrk (1 commits)")[![ConsoleTVs](https://avatars.githubusercontent.com/u/6124435?v=4)](https://github.com/ConsoleTVs "ConsoleTVs (1 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![dhassanali](https://avatars.githubusercontent.com/u/12805108?v=4)](https://github.com/dhassanali "dhassanali (1 commits)")[![amphetkid](https://avatars.githubusercontent.com/u/675332?v=4)](https://github.com/amphetkid "amphetkid (1 commits)")

---

Tags

doormaninvitelaravellaravel-packagephp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/clarkeash-doorman/health.svg)

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

###  Alternatives

[knuckleswtf/scribe

Generate API documentation for humans from your Laravel codebase.✍

2.3k14.2M63](/packages/knuckleswtf-scribe)[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

23.9k69.5k](/packages/grumpydictator-firefly-iii)[laravel/nightwatch

The official Laravel Nightwatch package.

36210.1M36](/packages/laravel-nightwatch)[directorytree/ldaprecord-laravel

LDAP Authentication &amp; Management for Laravel.

5752.3M18](/packages/directorytree-ldaprecord-laravel)[firefly-iii/data-importer

Firefly III Data Import Tool.

8045.8k](/packages/firefly-iii-data-importer)[duncanmcclean/statamic-cargo

Comprehensive e-commerce addon for Statamic. Build bespoke e-commerce sites without the complexity.

3416.9k](/packages/duncanmcclean-statamic-cargo)

PHPackages © 2026

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