spatie/laravel-login-link
Spatie Laravel Login Link adds a Blade component to render one-click login links for seeded users in local development. Great for admin areas and teams: pick a user/role without remembering credentials. Restricts usage by allowed hosts (defaults to localhost).
Pros:
laravel-permission, laravel-activitylog).Cons:
Illuminate\Auth\AuthManager). Custom auth backends (e.g., LDAP, OAuth) would need wrapper logic.php artisan vendor:publish --provider="Spatie\LoginLink\LoginLinkServiceProvider").file or database). Non-standard drivers (e.g., Redis clusters) could introduce edge cases.route:cache), login links may break until cache is cleared (mitigated by route:clear in CI/CD).| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Security misconfig | High | Disable in production; enforce HTTPS locally. |
| Session hijacking | Medium | Validate link expiration in middleware. |
| Route conflicts | Low | Prefix routes (e.g., /dev/login-link). |
| Auth guard conflicts | Medium | Test with custom guards (e.g., admin guard). |
| Link expiration | Low | Extend LoginLink::generate() TTL as needed. |
/admin) that should exclude login-link access? Custom middleware may be needed.App\Models\User with Illuminate\Auth\Authenticatable).php artisan tinker vs. manual seeding).Spatie\LoginLink\LoginLink to support custom guards or user attributes (e.g., role).env files).- name: Generate login links
run: |
php artisan login-link:generate --user=test@example.com --password=temp123 --hours=1
echo "LOGIN_LINK=$(php artisan login-link:link)" >> $GITHUB_ENV
| Component | Compatibility Notes |
|---|---|
| Laravel Version | Tested on Laravel 10+; may need polyfills for older versions (e.g., str() helpers). |
| PHP Version | Requires PHP 8.1+ (due to named arguments, attributes). |
| Session Drivers | Works with file, database, redis; test memcached separately. |
| Caching | Avoid route:cache in dev; use config('app.debug' => true). |
| Auth Providers | Default providers only; custom providers need manual link generation. |
superadmin user").Authenticatable contract), package may need forks.route:cache (solution: php artisan route:clear).config('session.lifetime')).php artisan login-link:list for active links.| Scenario | Impact | Mitigation |
|---|---|---|
| Link expiration | Lost access to test session. | Extend TTL or add manual regeneration. |
| Session driver failure | Links become invalid. | Use database driver for persistence. |
| Custom auth misconfig | Links fail silently. | Add try-catch in link generation. |
| CI/CD session cleanup | Orphaned sessions. | Use php artisan session:clear in post-job steps. |
| Production exposure | Security risk. | Block /login-link routes in WAF. |
php artisan tinker for 80% of test logins.php artisan login-link:generate --role=admin).How can I help you explore Laravel packages today?