Download the PHP package californiamountainsnake/simple-laravel-auth-system without Composer
On this page you can find all versions of the php package californiamountainsnake/simple-laravel-auth-system. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download californiamountainsnake/simple-laravel-auth-system
More information about californiamountainsnake/simple-laravel-auth-system
Files in californiamountainsnake/simple-laravel-auth-system
Package simple-laravel-auth-system
Short Description A simple realisation of authentication and authorization for Laravel
License MIT
Informations about the package simple-laravel-auth-system
simple-laravel-auth-system
A simple realisation of authentication and authorization for Laravel
Install:
Require this package with Composer
Install this package through Composer.
Edit your project's composer.json
file to require californiamountainsnake/simple-laravel-auth-system
:
and run composer update
or
run this command in your command line:
Usage:
- Extend Enum classes: (
AuthLangsEnum
,AuthUserAccountTypeEnum
,AuthUserRoleEnum
). - Extend the
AuthUserAvailableActions
class. You can add there any checks based on some user, like(new UserAvailableActions($user))->isSomeActionAvailableForThisUser()
. - Extend the
AuthUserEntity
class. This your main user class. See https://github.com/CaliforniaMountainSnake/php-database-entities. - Extend the
AuthUserRepository
class. This is the repository contains all user database queries in any from. See https://github.com/CaliforniaMountainSnake/php-database-entities. -
Extend the
AuthValidatorService
class contains the Laravel validation array forapi_token
request param. Like: -
Add some binding in Laravel
AppServiceProvider
: -
Extend the
AuthApiUserController
class and create your own base api controller. Realise the abstract methods. All actions of this controller (and it's children) will be automatic handled by the auth system. -
Now you can add your routes into the
www/routes/api.php
file like this: -
Catch the
MethodNotAllowedException
in theApp\Exceptions\Handler::render()
: - Create a language file (
/resources/lang/en/auth_middleware.php
) with api error messages:- auth_middleware.method_not_allowed
- auth_middleware.no_token_error
- auth_middleware.bad_token_error
- auth_middleware.wrong_role_error
- auth_middleware.wrong_account_type_error
- That's all)
All versions of simple-laravel-auth-system with dependencies
ext-json Version *
myclabs/php-enum Version ~1.5
laravel/framework Version ~5.7|~6.0|~7.0
californiamountainsnake/json-response Version ~1.0.1
californiamountainsnake/php-database-entities Version ~1.0.0
californiamountainsnake/php-utils Version ~1.0.7