PHPackages                             abstem/invites - 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. abstem/invites

ActiveLibrary

abstem/invites
==============

An Invitation-Based Membership System

0.0.1(8y ago)119MITPHPPHP &gt;=7.0

Since Nov 6Pushed 8y ago1 watchersCompare

[ Source](https://github.com/Abstem/Invites)[ Packagist](https://packagist.org/packages/abstem/invites)[ RSS](/packages/abstem-invites/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Invites
=======

[](#invites)

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

Invite Codes:

- 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.

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

[](#installation)

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

```
$ composer require abstem/invites
```

Next, register the service provider with Laravel (no need on version 5.5):

```
// config/app.php
'providers' => [
    ...
    Abstem\Invites\InvitesServiceProvider::class,
];
```

And, register the facade:

```
// config/app.php
'aliases' => [
    ...
    'Invites'   =>  Abstem\Invites\Facades\Invites::class,
];
```

Finally, migrate the database:

```
$ php artisan migrate
```

Usage
-----

[](#usage)

### Generate Invites

[](#generate-invites)

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

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

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

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

Make an invite with 10 redemptions and no expiry.

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

Make an invite that expires on a specific date.

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

Make an invite that expires in 14 days.

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

### Redeem Invites

[](#redeem-invites)

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

```
Invites::redeem('ABCDE');
```

If invites 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.

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

```
try {
    Invites::redeem(request()->get('code'), request()->get('email'));
} catch (InvitesException $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.

```
Invites::check('ABCDE');
```

### Change Error Messages (and translation support)

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

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

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

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

### Config - change table name

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

First publish the package configuration:

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

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

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

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

### Console

[](#console)

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

```
$ php artisan invites:cleanup
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

3112d ago

### Community

Maintainers

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

---

Top Contributors

[![RegiByte](https://avatars.githubusercontent.com/u/32272832?v=4)](https://github.com/RegiByte "RegiByte (7 commits)")

### Embed Badge

![Health badge](/badges/abstem-invites/health.svg)

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

###  Alternatives

[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k84.2M225](/packages/laravel-horizon)[stancl/tenancy

Automatic multi-tenancy for your Laravel application.

4.3k6.6M40](/packages/stancl-tenancy)[laravel/vapor-cli

The Laravel Vapor CLI

31310.7M8](/packages/laravel-vapor-cli)[dyrynda/laravel-model-uuid

This package allows you to easily work with UUIDs in your Laravel models.

4802.8M8](/packages/dyrynda-laravel-model-uuid)[directorytree/ldaprecord-laravel

LDAP Authentication &amp; Management for Laravel.

5682.0M15](/packages/directorytree-ldaprecord-laravel)[sassnowski/venture

A package to manage complex workflows built on top of Laravel's queue.

825254.5k1](/packages/sassnowski-venture)

PHPackages © 2026

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