Download the PHP package vielhuber/simpleauth without Composer
On this page you can find all versions of the php package vielhuber/simpleauth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vielhuber/simpleauth
More information about vielhuber/simpleauth
Files in vielhuber/simpleauth
Package simpleauth
Short Description Simple php authentication library.
License MIT
Informations about the package simpleauth
🔒 simpleauth 🔒
simpleauth is a simple php based authentication library.
it leverages:
- json web tokens
- bcrypted passwords
- full api
installation
install once with composer:
now simply create the following files in a new folder called auth
in your public directory:
/auth/index.php
/auth/.htaccess
/.env
if you want to migrate and seed data, simply run
and you should be done (a test user [email protected]
with the password secret
is created).\
you can now fully authenticate with the routes below.\
if you want to authenticate via username instead of email, simply change JWT_LOGIN to username
.
routes
the following routes are provided automatically:
route | method | arguments | header | response |
---|---|---|---|---|
/auth/login | POST | email password | -- | ([ 'success' => true, 'message' => 'auth successful', 'public_message' => '...', 'data' => [ 'access_token' => '...', 'expires_in' => 3600, 'user_id' => 42 ] ], 200) |
/auth/refresh | POST | -- | Authorization: Bearer token | ([ 'success' => true, 'message' => 'auth successful', 'public_message' => '...', 'data' => [ 'access_token' => '...', 'expires_in' => 3600, 'user_id' => 42 ] ], 200) |
/auth/logout | POST | -- | Authorization: Bearer token | ([ 'success' => true, 'message' => 'logout successful', 'public_message' => '...' ], 200) |
/auth/check | POST | access_token | -- | ([ 'success' => true, 'message' => 'valid token', 'public_message' => '...', 'data' => [ 'expires_in' => 3600, 'user_id' => 42, 'client_id' => 7000000 ] ], 200) |
further usage
you can use the following functions inside your own application (they do not need any database lookups):
frontend
if you need a neat frontend library that works together with simpleauth seemlessly, try out jwtbutler.
All versions of simpleauth with dependencies
vielhuber/dbhelper Version >=1.8
firebase/php-jwt Version ^5.0
vielhuber/comparehelper Version >=1.0
guzzlehttp/guzzle Version ^6.3
vlucas/phpdotenv Version *