Doorman – Limit access to your Laravel applications through invite codes
Published on by Eric L. Barnes
Doorman is a Laravel package that allows you to limit access to your Laravel applications by using invite codes.
Once installed you can generate and redeem invites through the Doorman facade and it includes support for Form Request validation.
You can generate new invites like this:
// Generate a single inviteDoorman::generate()->make(); // Generate five invitesDoorman::generate()->times(5)->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(); // Or even bind it to a specific personDoorman::generate()->for('me@example.org')->make();
Redeeming is just as simple:
Doorman::redeem('ABCDE');// orDoorman::redeem('ABCDE', 'me@example.org');
If you’d like to start a private invite system to your app check out the Doorman package on Github.
Eric is the creator of Laravel News and has been covering Laravel since 2012.