mixudev / laravel-authentication
Production-grade, modular, portable, and secure authentication package for Laravel applications.
Package info
github.com/mixudev/package_LaravelAuthentication
pkg:composer/mixudev/laravel-authentication
Requires
- php: ^8.2 || ^8.3 || ^8.4 || ^8.5
- chillerlan/php-qrcode: ^5.0
- illuminate/auth: ^11.0 || ^12.0 || ^13.0
- illuminate/contracts: ^11.0 || ^12.0 || ^13.0
- illuminate/database: ^11.0 || ^12.0 || ^13.0
- illuminate/events: ^11.0 || ^12.0 || ^13.0
- illuminate/http: ^11.0 || ^12.0 || ^13.0
- illuminate/support: ^11.0 || ^12.0 || ^13.0
- illuminate/validation: ^11.0 || ^12.0 || ^13.0
Requires (Dev)
- orchestra/testbench: ^9.2 || ^10.0 || ^11.0
- phpstan/phpstan: ^1.10 || ^2.0
- phpunit/phpunit: ^10.0 || ^11.0 || ^12.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-main
- v1.9.34
- v1.9.33
- v1.9.32
- v1.9.31
- v1.9.30
- v1.9.29
- v1.9.28
- v1.9.27
- v1.9.26
- v1.9.25
- v1.9.24
- v1.9.23
- v1.9.22
- v1.9.21
- v1.9.20
- v1.9.19
- v1.9.18
- v1.9.17
- v1.9.16
- v1.9.15
- v1.9.14
- v1.9.13
- v1.9.12
- v1.9.11
- v1.9.10
- v1.9.9
- v1.9.8
- v1.9.7
- v1.9.6
- v1.9.5
- v1.9.4
- v1.9.3
- v1.9.2
- v1.9.1
- v1.9.0
- v1.8.0
- v1.7.5
- v1.7.4
- v1.7.3
- v1.7.2
- v1.7.1
- v1.7.0
- v1.6.1
- v1.6.0
- v1.5.9
- v1.5.8
- v1.5.7
- v1.5.6
- v1.5.5
- v1.5.4
- v1.5.3
- v1.5.2
- v1.5.1
- v1.5.0
- v1.4.9
- v1.4.8
- v1.4.7
- v1.4.6
- v1.4.5
- v1.4.4
- v1.4.3
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.1
- v1.3.0
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.0
- v1.0.0
This package is auto-updated.
Last update: 2026-10-12 14:39:05 UTC
README
Arsitektur autentikasi enterprise siap produksi, modular, portable, dan aman (secure-by-default) untuk aplikasi Laravel 12.x dan 13.x.
Dirancang untuk monolit web, REST API, SPA, maupun arsitektur multi-tenant tanpa perlu modifikasi pada core code aplikasi host.
Security Defense Integration
Connect authentication events to enterprise threat detection & SIEM:
composer require mixudev/security-defense php artisan security-defense:install --with-opaque-path php artisan auth:sync
Wires 12 auth events (login, lockout, 2FA, device, password, session) into real-time threat correlation, IP quarantine, and multi-channel alerting. See integration guide.
Ringkasan Fitur Utama
| Modul & Fitur | Deskripsi Singkat |
|---|---|
| Passkey (FIDO2 / WebAuthn) | Login tanpa kata sandi via Touch ID, Face ID, Windows Hello, atau Security Key dengan dukungan autofill Conditional UI. |
| Multi-Factor Auth (2FA / TOTP) | Engine TOTP RFC 6238 mandiri (Google Auth, Authy, 1Password), kode pemulihan cadangan, dan fitur Trust This Device (30 hari). |
| Optimasi Skala 10M+ Data | Smart Fast-Path Credential Resolver dan Composite Indexing untuk performa pencarian < 1ms pada tabel puluhan juta baris. |
| Active Session & Device Manager | Deteksi platform/browser/IP, pencabutan sesi jarak jauh, dan Logout All Other Devices dengan konfirmasi password. |
| Granular Rate Limiting | Throttle counter independen per fitur (login, registration, otp, 2fa, forgot_password) mencegah cross-feature DoS. |
| Adaptive CAPTCHA & Bot Protection | Cloudflare Turnstile, Google reCAPTCHA v2/v3, dan hCaptcha dengan threshold otomatis (muncul setelah $N$ kali gagal). |
| OAuth Social Login | Autentikasi instan Google dan GitHub dengan layout modern yang sejajar dan responsif. |
| Passwordless OTP Email | Kode verifikasi sekali pakai kriptografis dengan limit percobaan dan auto-expiry. |
| Dual UI Template & Dark Mode | Template split (2 kolom) & card (kartu minimalis) dengan transisi mulus light, dark, dan auto (OS match). |
| 100% REST API Ready | Semua alur autentikasi tersedia dalam format JSON stateless (/api/v1/auth/*) dengan token Sanctum. |
Panduan Instalasi Cepat
1. Instalasi via Composer
composer require mixudev/laravel-authentication
Dependency matrix
The package's Composer dependencies are installed automatically by the command above. The following integrations are optional and are required only when their feature is enabled:
| Feature | Required package / service | Install or setup |
|---|---|---|
| Web login, registration, password reset, OTP, 2FA, sessions | Laravel application with database, cache, session, mail, and queue configuration | Included in Laravel; run package migrations |
| API bearer tokens | laravel/sanctum and HasApiTokens on the configured user model |
composer require laravel/sanctum; configure auth:sanctum |
| Social login | laravel/socialite |
composer require laravel/socialite; configure Google/GitHub credentials |
| CAPTCHA | Turnstile, reCAPTCHA, or hCaptcha account | Configure provider keys in .env only when CAPTCHA is enabled |
| Passkey / WebAuthn | HTTPS outside localhost and a browser with WebAuthn support | No extra Composer package; configure RP/origin correctly |
| QR code for TOTP setup | chillerlan/php-qrcode |
Installed as a required Composer dependency |
| Asynchronous email or audit persistence | A configured Laravel queue backend and a running worker | php artisan queue:work --queue=default,auth-audit |
| Redis rate limiting / queue / cache | Redis extension or a supported Redis client, depending on the Laravel setup | Optional; use database/file cache for development if suitable |
The package does not require Sanctum, Socialite, CAPTCHA, Redis, or a queue worker for every installation. Install and configure only the integrations used by the enabled features. API token flows fail closed without Sanctum instead of returning unusable tokens; social routes fail closed with an installation message when Socialite is missing.
Note
Untuk instalasi lokal / path repository (Monorepo), tambahkan repository path pada composer.json aplikasi Anda lalu jalankan composer require mixudev/laravel-authentication:@dev.
2. Setup Otomatis Satu Langkah (Direkomendasikan)
Jalankan perintah installer interaktif untuk mempublikasikan konfigurasi, migrasi, dan menyuntikkan class Tailwind CSS secara otomatis:
php artisan authentication:install
Atau jalankan manual jika ingin kontrol penuh:
# Publikasi konfigurasi & migrasi php artisan vendor:publish --tag=authentication-config php artisan vendor:publish --tag=authentication-migrations # Jalankan migrasi database php artisan migrate
Panduan Update Versi Baru
Ketika package merilis pembaruan versi (bugfix, fitur baru, atau peningkatan performa), lakukan langkah berikut pada aplikasi Anda:
# 1. Tarik pembaruan package terbaru composer update mixudev/laravel-authentication # 2. Jalankan migrasi jika ada skema database baru php artisan migrate # 3. Bersihkan cache view & konfigurasi php artisan view:clear php artisan config:clear
Tip
Jika Anda menggunakan Mode Single-Folder Module (modules/Authentication/), Anda dapat memperbarui modul dengan menjalankan php artisan authentication:install-module --force.
Ringkasan Konfigurasi (config/authentication.php)
return [ // Model user aplikasi host (tanpa hardcode App\Models\User) 'user_model' => \App\Models\User::class, 'guard' => 'web', // Fitur Kunci & Modul 'features' => [ // Passkey / WebAuthn FIDO2 Passwordless 'passkey' => [ 'enabled' => true, 'rp_name' => env('APP_NAME', 'Laravel'), 'user_verification' => 'preferred', 'timeout' => 60000, ], // Multi-Factor Authentication (2FA TOTP) 'two_factor' => [ 'enabled' => true, 'trust_device' => ['enabled' => true, 'duration_days' => 30], ], // Socialite OAuth (Google & GitHub) 'social' => [ 'enabled' => true, ], // Proteksi Bot Adaptif 'captcha' => [ 'enabled' => false, 'driver' => 'turnstile', // 'turnstile', 'recaptcha_v2', 'hcaptcha' 'trigger_after_failed_attempts' => 3, ], ], // Antarmuka & Tampilan UI 'ui' => [ 'layout' => 'card', // 'card' atau 'split' 'theme' => 'auto', // 'light', 'dark', atau 'auto' ], ];
Pusat Dokumentasi Lengkap (docs/)
Dokumentasi teknis mendalam telah disusun rapi di dalam direktori docs/:
- 1. Instalasi & Setup Lengkap — composer → publish → migrate → Tailwind → verifikasi
- 2. Prerequisites & API Keys — kredensial CAPTCHA, OAuth, SMTP + checklist produksi
- 3. Mode Modul Mandiri (Single-Folder)
- 4. Penjelasan Lengkap Fitur & Saklar Konfigurasi
- 5. Passkey FIDO2 / WebAuthn
- 6. Custom Controller Guide
- 7. Custom Authentication Strategies
- 8. Events & Listeners
- 9. Kustomisasi Tampilan (Blade UI) / Bahasa Indonesia
- 10. Katalog Lengkap REST API + Sitemap 49 Rute
- 11. Keamanan & Mitigasi Ancaman Siber
- 12. Hardening Notes (SA-01..SA-13)
- 13. Panduan Rilis & Standar Versioning
Standar Keamanan & Kode
- Zero Hardcoded Coupling: Tidak ada ketergantungan langsung ke
App\Models\User. Semua integrasi menggunakan dependency injection dan konfigurasi terpusat. - Sensitive Parameter Redaction: Semua argumen password dan secret menggunakan atribut
#[SensitiveParameter]PHP 8.2+ untuk mencegah kebocoran pada log dan error stack trace. - Fail-Closed by Design: Setiap anomali strategi atau channel yang tidak dikenali melempar explicit typed exceptions (
AuthenticationException). - Proteksi User Enumeration: Timing serangan enumerasi dinormalisasi agar waktu respons kredensial valid dan tidak valid bernilai konsisten.
- Pengujian Otomatis: Dilengkapi dengan unit & feature tests PHPUnit serta static analysis PHPStan Level 8.
# Menjalankan unit & feature tests vendor/bin/phpunit # Menjalankan static analysis level 8 vendor/bin/phpstan analyse
Lisensi
Package ini dirilis di bawah lisensi open-source MIT License.