| Package Data | |
|---|---|
| Maintainer Username: | abdurrahmanriyad |
| Maintainer Contact: | me.riyad@outlook.com (Abdur Rahman) |
| Package Create Date: | 2019-01-11 |
| Package Last Update: | 2019-01-18 |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-11-03 15:11:16 |
| Package Statistics | |
|---|---|
| Total Downloads: | 22 |
| Monthly Downloads: | 0 |
| Daily Downloads: | 0 |
| Total Stars: | 6 |
| Total Watchers: | 1 |
| Total Forks: | 0 |
| Total Open Issues: | 0 |
LumenAuth is a simple authentication package for lumen. This enables user to get rid of primary hassle to setup token based authentication in lumen.
composer require abdurrahmanriyad/lumenauth
$app->register(\Abdurrahmanriyad\LumenAuth\LumenAuthServiceProvider::class);
LUMEN_AUTH_SECRET=YOUR_SECRET_KEY
eg. LUMEN_AUTH_SECRET=7852ef15dcdd3eaeb40sdfasdf459171556
USER_MODEL=YOUR_USER_MODEL_NAMESPACE
eg. USER_MODEL=App\Models\User
For example,
$router->group(['middleware' => 'lumenAuth'],
function () use ($router) {
//your routes
});
For example,
use Abdurrahmanriyad\LumenAuth\Facades\LumenAuthFacade;
.......
class AuthController extends Controller {
public function login(Request $request) {
//validate user and check user
........
// Verify the password and generate the token
if (Hash::check($userPassword, $user->password)) {
return response()->json([
'token' => LumenAuthFacade::getToken($user)
], 200);
}
.........
}
}
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.