Download the PHP package vercodea/auth-core without Composer

On this page you can find all versions of the php package vercodea/auth-core. 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 auth-core

Vercodea Auth Core

๐Ÿ” Enterprise-grade PHP authentication system with advanced security features, rate limiting, OTP verification, and magic link recovery.

โšก 100% Plug and Play - Install โ†’ Configure โ†’ Initialize โ†’ Done. Everything is automated.

PHP Version Composer Build Status Security Scanning


๐Ÿ“‹ Table of Contents

โœจ Features


๐Ÿ“ฆ Requirements

Component Version Purpose
PHP 7.4+ or 8.0+ Core runtime
MySQL 5.7+ User and session data storage
Redis 5.0+ Session, OTP, and rate limit caching
PHP Extensions pdo, redis, curl, openssl, json Required PHP modules
Composer 1.9+ Dependency manager

PHP Extensions Verification


๐Ÿš€ Installation

Plug and Play Setup - Everything is automated. No manual SQL commands or database setup needed!

Step 1: Install via Composer

Step 2: Configure Environment

Edit .env and fill in your credentials:

All environment variables have secure defaults. See Configuration for complete list.

Step 3: Initialize Database (One-time)

That's it! All required tables are created automatically. No manual SQL commands needed.

Step 4: Start Using Authentication


โš™๏ธ Configuration

Environment Variables Reference

Database Configuration

Variable Default Description
MYSQL_HOST 127.0.0.1 MySQL server hostname or IP
MYSQL_PORT 3306 MySQL server port
MYSQL_USERNAME root Database username
MYSQL_PASSWORD `` Database password
MYSQL_DBNAME `` Database name
MYSQL_DIR_URL null Unix socket path (optional)
CHARSET utf8mb4 MySQL character set

Redis Configuration

Variable Default Description
REDIS_HOST 127.0.0.1 Redis server hostname
REDIS_PORT 6379 Redis server port
REDIS_PASSWORD `` Redis password (optional)

Authentication Configuration

Variable Default Description
OTP_EXPIRES 300 OTP validity in seconds (5 min)
OTP_VERIFICATION_ENABLED true Enable/disable OTP verification requirement
OTP_API_KEY `` Resend.com API key
SEND_OTP_URL https://api.resend.com/emails Email service endpoint
DOMAIN localhost Your application domain for emails

Rate Limiting Configuration

Variable Default Description
MAX_ATTEMPTS 5 Failed attempts before lockout
PENALTY_PERIOD 60 Lockout duration in seconds
LIMIT_EXPIRES 3600 Rate limit window in seconds (1 hour)

Session Configuration

Variable Default Description
SESSION_EXPIRY 3600 Session timeout in seconds (1 hour)
SESSION_COOKIE_SECURE false HTTPS only (set true in production)
SESSION_COOKIE_HTTPONLY true JavaScript access disabled
SESSION_COOKIE_SAMESITE Strict CSRF protection level
SESSION_COOKIE_PATH / Cookie path scope
SESSION_COOKIE_DOMAIN `` Cookie domain (empty string = current domain)

Security Configuration

Variable Default Description
APP_ENV development Environment mode (production/development)
CURLOPT_SSL_VERIFYPEER false SSL verification for external APIs (true in production)
LOG_DIR ./logs Application activity log directory
ACCOUNT_RECOVERY_LIMIT_TIME 300 Magic link validity in seconds (5 min)
ACCOUNT_RECOVERY_SUBDOMAIN_PATH http://localhost/recover Password recovery page URL

๐Ÿ“ง Email Notification System

Vercodea Auth Core includes a comprehensive email notification system that automatically alerts users of important authentication events using beautifully designed HTML templates.

Email Templates

1. OTP Verification Email

Sent when users request OTP during registration or authentication.

2. Password Recovery Email

Sent when users request account recovery via magic link.

3. Account Lockout Alert Email

Sent when suspicious activity is detected (too many failed login attempts).

Email Configuration

All email sending is handled via the Resend API. Configure these environment variables:

Template Customization

To customize email templates:

  1. Locate template files in: src/middleware/otp_manager/Otp_messages/messages/
  2. Edit HTML templates (OTP variables use {$variable_name} syntax)
  3. Available variables by template:
    • otp_code_msg.html: {$otp_code}
    • password_recovery.html: {$reset_url}
    • access_bridge_msg.html: {$ip_address}, {$blocked_at}, {$block_expires}

๐Ÿ—๏ธ Architecture & Middleware

The system uses a middleware pipeline architecture with multiple security layers:

Middleware Stack

Middleware Location Purpose
Pipeline Gateway file_access_lock/gateway_locker.php File-level access control - prevents unauthorized direct execution
Network Check network_check.php VPN/Proxy detection via ProxyCheck.io API
Rate Limiter ratelimit.php IP-based and user-based throttling with account lockout
OTP Manager otp_manager/otp_mailer.php OTP generation, caching, and email delivery
Email OTP Verifier email_otp_verifier.php OTP validation and one-time use enforcement
Session Manager session_manager.php Secure Redis-backed session handling
Start System start_system.php System initialization and boot sequence

Request Flow

Pipeline Access Control (Security Feature)

The gateway_locker.php middleware enforces a whitelist of allowed entry points. Only authorized files can directly execute authentication code.

How it works:

  1. Each authentication function verifies the caller is in the allowed files list
  2. Unauthorized direct execution attempts are blocked with HTTP 403
  3. Violations are logged for security audit

Example:


๐ŸŽฏ Quick Start

Here's a complete guide showing ALL 7 public methods in a real-world workflow:


๐Ÿ“š All Public Methods Reference

# Method Parameters Returns Purpose
1 init() None void Initialize database (one-time setup)
2 auth_send_otp(email) $email: string ['status' => bool, 'msg' => string] Send OTP to email
3 auth_register(name, username, email, password, otp_input) 5 params ['status' => bool, 'msg' => string] Register new user
4 auth_login(username, email, password) 3 params ['status' => bool, 'msg' => string] Login user
5 auth_logout() None ['status' => bool, 'msg' => string] Logout user
6 auth_account_recovery_link(email) $email: string ['status' => bool, 'msg' => string] Send recovery link
7 auth_verify_recovery(id, token, password, confirm) 4 params ['status' => bool, 'msg' => string] Reset password

โœ… Response Format

All methods (except init()) return a standardized response:

Always check $result['status'] before proceeding:


๐Ÿ“š API Reference

AuthInit Class - All Public Methods

The AuthInit class provides 7 public methods for complete authentication workflow:

1. Initialize Database

Initializes the database by creating all required tables. Run this once during installation.


2. Send OTP

Parameters:

Returns: ['status' => bool, 'msg' => string]

Example:


3. Register User

Parameters:

Returns: ['status' => bool, 'msg' => string]

Example:


4. Login User

Parameters:

Returns: ['status' => bool, 'msg' => string]

Example:


5. Logout User

Parameters: None

Returns: ['status' => bool, 'msg' => string]

Example:


6. Request Password Recovery

Parameters:

Returns: ['status' => bool, 'msg' => string]

Example:


7. Verify Recovery & Reset Password

Parameters:

Returns: ['status' => bool, 'msg' => string]

Example:


Response Format

All methods return a consistent structure:

Always check the status before proceeding:


๏ฟฝ Execution Flow Diagrams

1. ๐Ÿš€ AuthInit::init() - System Initialization

2. ๐Ÿ“ง AuthInit::auth_send_otp() - Send OTP Email

3. ๐Ÿ‘ค AuthInit::auth_register() - User Registration

4. ๐Ÿ” AuthInit::auth_login() - User Login

5. ๐Ÿšช AuthInit::auth_logout() - User Logout

6. ๐Ÿ”‘ AuthInit::auth_account_recovery_link() - Send Recovery Link

7. ๐Ÿ”“ AuthInit::auth_verify_recovery() - Reset Password


๏ฟฝ๐Ÿ” Security Features

Password Security

Feature Details
Hashing Algorithm bcrypt (PASSWORD_DEFAULT)
Minimum Length 8 characters
Required Character Types Uppercase, lowercase, number, special character
Blocked Passwords 94,500+ common weak passwords + reserved words
Validation Rules Cannot match username or email, max 4096 chars

Rate Limiting & Brute Force Protection

Feature Details
Signup Rate Limit IP-based: 5 attempts per hour (configurable)
Signin Rate Limit Dual-layer: IP + User account tracking
Lockout Duration 60 seconds (configurable via PENALTY_PERIOD)
Penalty Response HTTP 429, retry-after header
Account Lockout Alert Email notification sent to user with attack details
Lockout Information Included IP address, timestamp, duration, security timeline

Email Notification Security

Feature Details
OTP Emails Beautiful HTML templates with 6-digit codes
Recovery Emails Secure magic link with unique token + ID
Lockout Alerts Suspicious activity notifications with timeline
Email Validation RFC-compliant format checks before sending
API Integration Resend API with Bearer token authentication
Template System Customizable HTML messages via OtpMessageLoader
Security Timeline Visual representation of LOCKED โ†’ COOLDOWN โ†’ UNLOCKED states

Session & CSRF Protection

Feature Details
Session Storage Redis-backed with automatic expiration
Session Timeout 1 hour (configurable)
CSRF Token Separated from session ID, SHA256 hashed
Token Validation hash_equals() for timing-safe comparison
Cookie Security HttpOnly, Secure, SameSite=Strict by default

Network Security

Feature Details
VPN/Proxy Detection Real-time API check via ProxyCheck.io
Blocked IPs VPN, proxy, and malicious IP detection
Development Bypass Localhost (127.0.0.1) allowed in development

Input Validation

Field Validation Rules
Email RFC-compliant format via filter_var()
Username 3-50 chars, alphanumeric + _.-
Name 2-100 chars, letters and spaces only
Password 8+ chars, mixed case, numbers, special chars
OTP Exactly 6 digits

SQL Injection Prevention

Additional Security Measures

Feature Details
Pipeline Access Control File-level security prevents direct execution, whitelist-based
Gateway Locker Middleware verify_pipeline_access() enforces allowed file execution
Error Handling Production-safe logging, no error display to users
OTP One-Time Use OTP deleted immediately after verification
Magic Link Single-Use Recovery tokens deleted after password reset
Activity Logging All authentication events logged with audit trail
Middleware Stack Network check โ†’ Rate limit โ†’ Auth โ†’ Session โ†’ Logging
Intrusion Prevention Blocks unauthorized file access attempts with logging

๐Ÿ“ Activity Logging

Log Location

Logs are written to: ./logs/activity.log

Configure with: LOG_DIR environment variable

Log Format

Logged Events

Event Example Log Message
User Login User {username} logged in successfully from {IP}
User Signup New user registered: {username} ({email})
User Logout {username} logged out successfully at {timestamp}
OTP Sent OTP sent to {email}
OTP Email Sent Magic link email sent to {email}
OTP Verified OTP verified successfully for: {email}
OTP Failed OTP verification failed (incorrect/expired) for: {email}
Recovery Link Account recovery link sent to {email}
Password Reset Password reset successful for email: {email}
Rate Limit Hit Rate limit exceeded for IP: {IP} (signup attempts)
Account Locked Account locked: {username} exceeded max signin attempts from {IP}
Lockout Email Sent Lockout notification sent to {email}
VPN Detected Security Alert: VPN/Proxy detected for IP: {IP}
Pipeline Violation Vercodea Intrusion Prevention: Pipeline Violation by [{caller_file}]
Invalid Access Unauthorized access attempt from {IP}

๐Ÿ—„๏ธ Database Schema

Automatic Table Creation

When you call AuthInit::init(), all required database tables are created automatically. No manual SQL needed!

The tables are created from src/Query/Query_commands/startup/createtables.sql and include:

Users Table Structure

Column Type Details
id INT Primary key, auto-increment
username VARCHAR(255) Unique login identifier
email VARCHAR(255) Unique email address
password VARCHAR(255) bcrypt hashed password
name VARCHAR(100) User display name
created_at TIMESTAMP Account creation time
updated_at TIMESTAMP Last update time

No manual CREATE TABLE commands required. The AuthInit::init() method handles everything.

Redis Schema

Session Storage

OTP Storage

Rate Limit Storage (Signup)

Rate Limit Storage (Signin)

Magic Link Recovery


โœ… Best Practices

1. Environment Security

2. HTTPS Enforcement

3. Error Handling

4. Rate Limiting

5. Session Management

6. OTP Verification


๐Ÿ”ง Troubleshooting

Redis Connection Error

Problem: Redis connection error: Connection refused

Solution:

MySQL Connection Error

Problem: SQLSTATE[HY000]: General error: Can't connect to MySQL server

Solution:

OTP Not Sending

Problem: Failed to send OTP. Please try again.

Solution:

Initialization Failed

Problem: AuthInit::init() fails with database error

Solution:

Rate Limit Triggering Too Early

Problem: Users locked out after 2-3 attempts

Solution: Adjust in .env:

Session Expiring Too Quickly

Problem: Users logged out after 15 minutes

Solution:

Password Validation Rejected

Problem: Strong password rejected as "too common"

Requirements: Minimum 8 characters with:

Valid example: SecurePass123!@#


๏ฟฝ Roadmap & Planned Features

Current Version: 1.0.0 โœ… Production Ready


๐Ÿ”„ Phase 2: Enhanced Security (v1.1.0)

๐Ÿ” Two-Factor Authentication (2FA)

๐Ÿ”‘ Passwordless Authentication (WebAuthn)

๐Ÿ›ก๏ธ IP Whitelist/Blacklist Management


๐Ÿ”„ Phase 3: Enterprise Features (v2.0.0)

๐Ÿ”Œ OAuth2 / OpenID Connect

๐ŸŒ Webhook Support

๐ŸŽ›๏ธ Audit Dashboard UI

๐Ÿ‘‘ Admin Authentication System


๐Ÿ”„ Phase 4: Performance & Scale (v2.1.0)

โšก Performance Optimizations

๐Ÿ“Š Monitoring & Alerting

๐Ÿ”„ Session Management Enhancements


๐Ÿ“… Release Timeline

Version Features Target Date
v1.0.0 โœ… Current - Core authentication system Released
v1.1.0 ๐Ÿ”„ 2FA + WebAuthn + IP Management Q3 2026
v2.0.0 ๐Ÿ”„ OAuth2/SSO + Webhooks + Admin Dashboard Q4 2026
v2.1.0 ๐Ÿ”„ Performance + Monitoring + Multi-session Q1 2027

๐Ÿ—ณ๏ธ Feature Request

Have a feature in mind? Open an issue or start a discussion!

Priority is determined by community demand. โญ


๐Ÿค Contributing

We welcome contributions! Areas needing help:

See CONTRIBUTING.md for guidelines.

Stay updated: โญ Star the repo on GitHub to receive release notifications!


๐ŸŽจ Visual Timeline


๐Ÿ“‹ Feature Comparison Table

Feature v1.0.0 v1.1.0 v2.0.0 v2.1.0
Core Auth โœ… โœ… โœ… โœ…
Rate Limiting โœ… โœ… โœ… โœ…
OTP Verification โœ… โœ… โœ… โœ…
Magic Link Recovery โœ… โœ… โœ… โœ…
VPN/Proxy Detection โœ… โœ… โœ… โœ…
Activity Logging โœ… โœ… โœ… โœ…
2FA (TOTP) โŒ ๐Ÿ”„ โœ… โœ…
WebAuthn/Passkeys โŒ ๐Ÿ”„ โœ… โœ…
IP Whitelist/Blacklist โŒ ๐Ÿ”„ โœ… โœ…
OAuth2/OpenID Connect โŒ โŒ ๐Ÿ”„ โœ…
Social Login โŒ โŒ ๐Ÿ”„ โœ…
Admin Dashboard โŒ โŒ ๐Ÿ”„ โœ…
Webhooks โŒ โŒ ๐Ÿ”„ โœ…
Multi-session Management โŒ โŒ โŒ ๐Ÿ”„
Performance Scaling โŒ โŒ โŒ ๐Ÿ”„

๏ฟฝ๐Ÿ“„ License

Vercodea Auth Core is open-source software licensed under the MIT License.


๏ฟฝ How It Works

Fully Automated Setup

  1. Install โ†’ composer require vercodea/auth-core
  2. Configure โ†’ Copy .env.example to .env, fill in credentials
  3. Initialize โ†’ Call AuthInit::init() once (creates all database tables)
  4. Use โ†’ Start calling AuthInit::auth_login(), AuthInit::auth_register(), etc.

No manual SQL. No table creation. No MySQL CLI. Everything automatic.


๏ฟฝ๐Ÿ”— Resources & Support

๐Ÿค Contributing

Contributions are welcome! Please read our Contributing Guidelines before submitting PRs.

Development Setup


๐Ÿ“ž Support & Security


๐ŸŽ‰ Why Vercodea Auth Core?

โœจ Zero Configuration - Sensible defaults for all settings

โšก Plug and Play - composer require โ†’ configure .env โ†’ AuthInit::init() โ†’ done

๐Ÿ”’ Enterprise Security - All security best practices built-in

๐Ÿ“Š Production Ready - Used in production applications

๐Ÿ“ Complete Audit Trail - Every auth event logged

๐Ÿš€ Easy Integration - Simple API, one class to learn


๐Ÿ“Š Status & Roadmap

Current Version: 1.0.0

โœ… Completed Features

๐Ÿšง Planned Features


Install โ†’ Configure โ†’ Init โ†’ Use

That's all you need to do. Everything else is automated.

No manual SQL. No table creation. No MySQL CLI. 100% plug and play. ๐Ÿš€


Audit Trail - View project transparency and history


Made with โค๏ธ by Prince Uche

Admin ยท Author ยท Developer

Last Updated: June 14, 2026


All versions of auth-core with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
ext-pdo Version *
ext-redis Version *
ext-curl Version *
ext-openssl Version *
ext-json Version *
vlucas/phpdotenv Version ^5.6
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 vercodea/auth-core contains the following files

Loading the files please wait ...