Manage Invite Codes for Your Laravel Applications

Packages

February 20th, 2020

Manage Invite Codes for Your Laravel Applications

Laravel Invite Codes is a package by Mateus Junges that allows you to manage invite codes for your Laravel application easily. It works by configuring a middleware that validates an invite code before accessing a route:

Route::get('/protected-route', function() {
//
})->middleware('protected_by_invite_codes');

You can generate an invite code using the following API, restricting this code to a specific user account:

use \Junges\InviteCodes\Facades\InviteCodes;
 
$invite_code = InviteCodes::create()
->expiresAt('2020-02-01')
->maxUsages(10)
->restrictUsageTo('contato@mateusjunges.com')
->save();

You can learn more about this package, get full installation instructions, and view the source code on GitHub at mateusjunges/laravel-invite-codes.

Filed in:

Paul Redmond

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.