Auth service for Laravel / Lumen framework.
132
0
2
Package Data
Maintainer Username: Fabrizio Cafolla
Maintainer Contact: developer@fabriziocafolla.com (Fabrizio Cafolla)
Package Create Date: 2019-04-28
Package Last Update: 2019-08-24
Language: PHP
License: MIT
Last Refreshed: 2024-11-19 03:06:04
Package Statistics
Total Downloads: 132
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

KosmosX Auth

Installation

composer require kosmosx/auth

php artisan kosmosx:publish:auth //if will be use JWT

Laravel

Add provider in array 'providers' (config/app.php)

Kosmosx\Auth\Providers\ManagerServiceProvider::class

Add to (config/auth.php)

'service_providers' => [
    'jwt' =>  env('AUTH_PROVIDERS', Tymon\JWTAuth\Providers\LaravelServiceProvider::class)
],

'guards' => [
    ...
    
    'api' => [
        'provider' => 'jwt',
        'driver' => 'jwt',
    ],
],
		
'providers' => [
    ...
    
    'jwt' => [
            'driver' => 'eloquent',
            'model' => env('AUTH_MODEL', App\Models\User::class),
        ],
]

Add to .env file

AUTH_PROVIDERS=Tymon\JWTAuth\Providers\LaravelServiceProvider

Lumen

File bootstrap/app.php

//uncomment this line:
$app->withFacades();
$app->withEloquent();

//Register providers
$app->register(Kosmosx\Auth\ManagerServiceProvider::class);

Add to .env file (Or change config/auth.php key of array 'providers')

AUTH_PROVIDERS=Tymon\JWTAuth\Providers\LumenServiceProvider

Example

AuthService::guard();  //return Illuminate/Guard

AuthService::getUser();  //return HttpException or Auth user

AuthService::refresh();  //return new token of Auth user

and other functions