davidgut / simple-auth
A simple authentication package for Laravel.
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/davidgut/simple-auth
Requires
- php: ^8.2
- illuminate/support: ^11.0|^12.0
Requires (Dev)
- orchestra/testbench: ^9.0|^10.0
- pestphp/pest: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
README
A flexible, drop-in authentication package for Laravel applications, featuring Magic Links and standard Password authentication. No JavaScript required.
Features
- Magic Link Authentication: Secure, passwordless login via email.
- Password Authentication: Traditional email/password flow with Forgot Password functionality.
- Security First: Rate limiting, timing attack protection, and secure URL signing.
- Agnostic Views: Clean, unstyled Blade views (Tailwind-ready classes) that inherit your app's design.
- Internationalization: Fully translatable UI strings.
- Configurable: Extensive configuration for methods, redirects, and user models.
Installation
composer require davidgut/simple-auth
Configuration
To customize config/simple-auth.php, publish the configuration file:
php artisan vendor:publish --tag="simple-auth-config"
Views
To customize the login and signup pages, publish the views:
php artisan vendor:publish --tag="simple-auth-views"
Translations
To customize the text strings, publish the language files:
php artisan vendor:publish --tag="simple-auth-lang"
Assets
To ensure the login pages are styled correctly, publish the package assets (compiled Tailwind CSS):
php artisan vendor:publish --tag="simple-auth-assets"
Auth Methods
Environment Variables
You can configure the package by adding the following variables to your .env file:
SIMPLE_AUTH_DEFAULT_METHOD=password SIMPLE_AUTH_MAGIC_LINK_ENABLED=true SIMPLE_AUTH_MAGIC_LINK_TTL=15 SIMPLE_AUTH_PASSWORD_ENABLED=true SIMPLE_AUTH_REDIRECT_AFTER_LOGIN=/ SIMPLE_AUTH_REDIRECT_AFTER_LOGOUT=/
Usage
Routes
The package registers the following routes automatically:
GET /login- Login pagePOST /login/{method}- Process loginGET /signup- Signup pagePOST /signup- Process signupPOST /logout- LogoutGET /forgot-password- Request password reset linkPOST /forgot-password- Send password reset linkGET /reset-password/{token}- Reset password formPOST /reset-password- Update password
Views
The views are available at resources/views/vendor/simple-auth after publishing. They use standard Tailwind CSS classes and link to the published simple-auth.css.
Translations
All text strings are translatable. After publishing, you can find them in resources/lang/vendor/simple-auth.
Testing
Run the test suite:
./vendor/bin/pest
License
The MIT License (MIT).