Download the PHP package laswitchtech/php-auth without Composer
On this page you can find all versions of the php package laswitchtech/php-auth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download laswitchtech/php-auth
More information about laswitchtech/php-auth
Files in laswitchtech/php-auth
Package php-auth
Short Description Authentication and Authorization Library for PHP
License GPL-3.0-only
Informations about the package php-auth
phpAUTH
Features
- Authentication Support BASIC, BEARER and SESSION
- 3rd-party Authentication Support through SMTP or IMAP
- Authorization Support
- Cross-site Request Forgery Protection (phpCSRF)
- 2-Factor Authentication Support (phpSMTP,phpSMS)
- Hostname Validation
- GDPR Cookie Compliance
- CCPA Cookie Compliance
- Email Verification
Why you might need it
If you are looking for an easy way to setup authentication and authorization in your project. This PHP Class is for you.
Can I use this?
Sure!
License
This software is distributed under the GNU General Public License v3.0 license. Please read LICENSE for information on the software availability and distribution.
Requirements
- PHP >= 7.3.0
- MySQL or MariaDB
Security
Please disclose any vulnerabilities found responsibly – report security issues to the maintainers privately.
Objects
- User
- Organization
- Group
- Role
- Permission
Relationships
This library also includes support for relationships. Here are the ones already used in phpAUTH
:
- User - Organization : User is a member of the Organization.
- User - Group : User is a member of the Group.
- User - Role : User is a member of the Role.
- Organization - Organization : Organization is a member of the Organization. Also known as a Subsidiary.
- Organization - Group : Organization can use the Group to manager it's members.
- Organization - Role : Organization can use the Role to manager it's members.
- Group - Role : Group is a member of the Role.
User Statuses
- 1: User is deleted (soft)
- 2: User is banned
- 3: User is locked out
- 4: User has reach a rate limit (request or attempts)
- 5: User is inactive
- 6: User's e-mail is not verified
- 7: User does not have any restrictions. OK.
Understanding Roles and Groups
When using this library, permissions are assigned on roles. Roles can be assigned directly to a user or through a group of users. The highest permission level provided is used for validation. For example, if a user is member of role Administrator
and User
, both possess the permission Dashboard
, Administrator
's level is set to 4
and User
's level is set to 1
, then the effective permission level is 4
.
Permission Levels
- 0: No access allowed
- 1: Read access allowed
- 2: Create access allowed
- 3: Edit access allowed
- 4: Delete access allowed
Installation
Using Composer:
How do I use it?
IMPORTANT NOTICE, phpAUTH
does not handle http headers. phpAUTH
relies on your application to handle those. If you want your application to throw 403
headers for exemple, you will need to use the related method for validation and then throw your headers accordingly.
Examples
There are many examples for you to check out in the example folder.
Initiate
Generate a GDPR/CCPA Compliance HTML Form
Check if we can access through a specific hostname
Check if a User has a specific permission
Check if a User was authenticated
Check if 2FA Request is ready
This method is useful to determine when to show the 2FA form.
Check if email is verified
This method is useful to determine if the user's email address has been verified.
Logout user
This method logs out the user.
Retrieve Authentication Error
This method retrieves authentication errors.
Retrieve Authentication Status
This method retrieves the user's status.
Using Managers
First managers allow you to manage objects such as Users, Organizations, Groups, Roles and Permissions
Using Objects
Installer Example
All versions of php-auth with dependencies
laswitchtech/php-database Version ^2.2
laswitchtech/php-csrf Version ^1.0
laswitchtech/php-imap Version ^2.0
laswitchtech/php-smtp Version ^2.0
laswitchtech/php-logger Version ^1.1
laswitchtech/php-configurator Version ^1.0
laswitchtech/php-sms Version ^1.0
laswitchtech/php-net Version ^1.1