PHP-Auth is a simple, lightweight, and secure PHP authentication library designed to provide robust user authentication and management across any framework or database.
Authentication for PHP. Simple, lightweight and secure.
This tool is used by PHP developers who need to implement secure and reliable authentication systems without building them from scratch. It is ideal for projects requiring user registration, login, password management, and two-factor authentication while maintaining framework and database independence.
Requires PHP 5.6.0 or higher with PDO and OpenSSL extensions enabled. Compatible with multiple SQL databases but requires appropriate drivers. Best practice includes using the provided SQL scripts to set up database tables and following the upgrade guide when migrating versions. Commercial support is available for enterprise needs.
Run composer require delight-im/auth to include the library
Include the Composer autoloader in your PHP script with require __DIR__ . '/vendor/autoload.php';
Set up a compatible database (MySQL, MariaDB, PostgreSQL, or SQLite)
Create the required tables using the provided SQL scripts for your database
$ composer require delight-im/auth
Installs the PHP-Auth library via Composer
require __DIR__ . '/vendor/autoload.php';
Includes the Composer autoloader to enable library usage
Creating a new instance
Initializes the authentication class to start using the library
Registration (sign up)
Registers a new user account
Login (sign in)
Authenticates an existing user
Email verification
Handles user email confirmation processes
Password reset (forgot password)
Manages the password reset workflow including request initiation, verification, and password update
Two-factor authentication (2FA)
Enables or disables two-factor authentication for enhanced security
Roles (or groups) management
Assigns and checks user roles and permissions
Throttling or rate limiting
Prevents brute-force attacks by limiting authentication attempts
Logout
Ends the user session securely