Download the PHP package muradcade/secureauth without Composer
On this page you can find all versions of the php package muradcade/secureauth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download muradcade/secureauth
More information about muradcade/secureauth
Files in muradcade/secureauth
Package secureauth
Short Description SecureAuth is a lightweight PHP package designed to simplify common web application security and authentication tasks, including validation, CSRF protection, authentication, authorization, email sending, and “remember me” functionality.
License MIT
Informations about the package secureauth
SecureAuth PHP Package
SecureAuth is a lightweight PHP package designed to simplify common web application security and authentication tasks, including validation, CSRF protection, authentication, authorization, email sending, and “remember me” functionality.
Table of Contents
- Installation
- Validation
- Usage
- Validation Rules
- BaseRepository
- Usage
- Authentication
- Usage
- Authorization
- Usage
- Email Jobs
- Usage
- RememberMe Token
- Usage
- Rate Limiter
- Database Schema
- How It Works
- Example Usage
- Environment Configuration
- Example Workflow
- Login Logic
- SecureAuth PHP Package License
Installation
Install via Composer:
Validation
SecureAuth wraps Laravel’s validation components for simple and robust validation.
Validation Usage
Validation Rules
Rule | Description |
---|---|
required | Field must not be empty |
Must be a valid email format | |
min:8 | Minimum 8 characters |
strong_password | Must include uppercase, lowercase, numbers, and symbols |
verify_csrftoken | Validates that the CSRF token is valid |
BaseRepository
Provides database interaction using prepared statements with MySQLi.
BaseRepository Usage
- Supports SELECT, INSERT, UPDATE, DELETE operations.
Authentication
Authenticate users with database data and manage sessions.
Authentication Usage
Authorization
Check user login status and role-based access.
Authorization Usage
Email Jobs
Supports sending emails with or without attachments using a worker-job system.
Job Structure
- JobInterface – Defines rules for processing email jobs.
- EmailJob – Handles sending emails.
- WorkerJob – Dispatches email jobs.
Email Jobs Usage
RememberMe Token
Manages persistent login tokens stored in cookies.
RememberMe Token Usage
Environment Configuration
Rate Limiter
The Rate Limiter is responsible for preventing brute-force login attacks by limiting the number of failed login attempts a user can make within a specified timeframe. It works by storing failed attempts in a database table and checking whether the threshold has been exceeded before processing further login requests.
Database Schema
Before using the Rate Limiter, create the login_attempts
table:
How It Works
- Store Failed Attempts : Every time a login attempt fails (invalid email or password), an entry is stored in the login_attempts table.
- Check Attempt Limits:Before processing a new login, the RateLimiter checks if the IP/email combination has exceeded the maximum allowed attempts in the defined interval.
- Block Excessive Attempts: If the limit is reached, the login is denied. The user must wait until the retry window has expired before attempting again.
- Reset After Success:On successful login, all attempts for that user/email are cleared.
Example Usage
Below is how you integrate the RateLimiter inside your login controller or login handler:
Example Workflow
Here’s how everything ties together in a login flow:
Login Page (index.php)
Login Logic
This file handles:
- Input validation
- CSRF token generation & validation
- Rate limiting
- User authentication
- Remember Me functionality
SecureAuth PHP Package License
Copyright (c) 2025 Muradcade
Permission is granted to anyone to use, copy, and distribute this software for any purpose, including personal and commercial use.
You are free to:
- View the source code.
- Use it in your own projects.
- Fork it for personal use.
You are not allowed to:
- Modify the official repository.
- Claim ownership of the official codebase.
- Merge changes into the official repository.
The original author (Muradcade) retains the exclusive right to update and maintain the official repository.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT ANY WARRANTY.
USE IT AT YOUR OWN RISK. The author is not responsible for any damages, data loss, or other issues arising from the use of this software.
All versions of secureauth with dependencies
phpmailer/phpmailer Version ^6.10
illuminate/validation Version ^12.28
illuminate/translation Version ^12.28
illuminate/container Version ^12.28