Download the PHP package sun-asterisk/php-auth without Composer

On this page you can find all versions of the php package sun-asterisk/php-auth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-auth

Tech Standard PHP Auth

CILicense

🌟 Introduction

Sun* Auth is a library designed to provide authentication and authorization features for web/mobile applications. It is built using modern technologies and provides a range of features that make it easy to integrate into existing applications.

One of the key reasons for using Sun* Auth is its ease of use. It provides a simple library that makes it easy to add authentication and authorization to any application. Additionally, it is designed to be highly customizable, allowing developers to tailor it to their specific needs.

Using Sun Auth saves time and effort for developers, as we do not have to independently write and test complex authentication and authorization features. Additionally, Sun Auth provides a simple and easy-to-understand library that makes it easy to integrate into existing web/mobile applications.

Some of the features provided by Sun* Auth include user registration and login, password reset and recovery.



🔌 Installation

Require the package via Composer:

Laravel

Add the service provider to the providers array in the config/app.php config file as follows:

Publish the configuration file:

Lumen

Configuration

Other

Configuration

Review the configuration file:

Detail

 

Usage

We will take an example of usage in Laravel.

Configure Auth guard

Inside the config/auth.php file you will need to make a few changes to configure

Add auth:api middleware to routes that require login authentication

Injection dependencies use JWT

Injection dependencies use Session

Login:

Request Field Field Type Required Field Desc
username string true username for user
password string true password for user
Response Field Field Type Required Field Desc
refresh_token string true refresh_token for user get access_token
access_token string true access_token for user logged
token_type string true token_type for user logged
expires_at integer true expires_at for user logged

Usage with JWT

Detail

 

Usage with Session

Detail

 

Example

Logout

Request Field Field Type Required Field Desc
Authorization Bearer true access_token for authenticate
Response Field Field Type Required Field Desc
N/A N/A N/A return code 204 - noContent

Usage with JWT

Detail

 

Usage with Session

Detail

 

Example

Register

Request Field Field Type Required Field Desc
username string true username for user
password string true password for user
email string true email for user
Response Field Field Type Required Field Desc
id integer true id for user
username string true username for user
email string true email for user

Usage with JWT

Detail

 

Usage with Session

Detail

 

If do you want after register, user will authenticated, Please set true for argument $setGuard as bellow

Example:

Forgot-password

Request Field Field Type Required Field Desc
email string true email for user
Response Field Field Type Required Field Desc
ok boolean false status for the request
type string false type of the request

Make postForgotPassword function as the following:

Detail

 

Make confirm function as the following:

Detail

 

Make newPassword function as the following:

Detail

 

Example

Verify

Request Field Field Type Required Field Desc
token string true Get token from email
Response Field Field Type Required Field Desc
ok boolean false status for the request

New Password

Request Field Field Type Required Field Desc
password string true password for user
token string true token from user's email
Response Field Field Type Required Field Desc
ok boolean false status for the request
type string false type of the request

Refresh token

Request Field Field Type Required Field Desc
refresh_token string true refresh_token for user get access_token
Response Field Field Type Required Field Desc
refresh_token string true refresh_token for user get access_token
access_token string true access_token for user logged
token_type string true token_type for user logged
expires_at integer true expires_at for user logged

Make Refresh function the following:

Example

Social Login custom

Login With Google

To use you need to install the socialiteproviders/google package via composer:

Add configuration to config/services.php

Update config enabled_social is true to config/sun-asterisk.php

config/sun-asterisk.php

Detail

 

routes/web.php

Detail

 

Architecture

Architecture Login

Workflow

Sun_ Auth _ Architecture Design-Login (1)

Explain

Interface

  1. Validator

  2. Find item by attribute

  3. Compare hash password

  4. Generate accessToken & refreshToken from jwt

Method login will return an array

BTW: Also we can change the sql query for the login flow as follows

Architecture Logout

Workflow

Explain

  1. Setting Guard to service provider

  2. Create method logout in SunGuard

  3. Invalidate token and refreshToken

Architecture Register

Workflow

Sun_ Auth _ Architecture Design-Register

Explain

Interface

  1. Validator

  2. Hash Password

  3. Insert params to database

Method register will return an array

Custom register

You can changes or validate attributes as following

Architecture Forgot password

Workflow

Sun_ Auth _ Architecture Design-Resending confirmation request_email

Explain

Interface

  1. Verify Email

  2. Generate token

  3. Verify token

  4. Change password

Architecture Refresh token

Workflow

Sun_ Auth _ Architecture Design-Refresh token

Explain

Interface

  1. Decode refresh token

  2. Compare exp time of the refresh token

  3. Verify user exists

  4. Revoke all access token

  5. Re generate access token

Method refresh will return an array

Architecture Social Login custom

Workflow

Sun_ Auth _ Architecture Design-Social sign-in (1)

Explain

Interface

  1. Redirect

  2. Callback

All versions of php-auth with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
illuminate/database Version ^8.0|^9.0|^10.0
illuminate/support Version ^8.0|^9.0|^10.0
illuminate/http Version ^8.0|^9.0|^10.0
illuminate/routing Version ^8.0|^9.0|^10.0
illuminate/contracts Version ^8.0|^9.0|^10.0
illuminate/validation Version ^8.0|^9.0|^10.0
firebase/php-jwt Version ^6.3
socialiteproviders/manager Version ^4.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sun-asterisk/php-auth contains the following files

Loading the files please wait ....