Slash Login: Bypass Laravel login screens when developing or testing
A Laravel package to streamline development workflows by allowing quick login as any user when developing or testing Laravel applications.
Let's be honest, developing Laravel applications can be a blast. But there's one thing that can really drag you down: the dreaded login form. You need to preview changes, give demos, test different user roles - all of which require logging in and out repeatedly. It's enough to make you scream! So, I did something about it.
At first, it was just a simple line of code in a routes file. But hey, that's developer life, right? Quick fixes. Here's the problem though: code in routes files can easily slip into your Git repository and end up deployed in production. Trust me, a rogue login route in production is way worse than a bad hair day.
That's when the idea for SlashLogin - a separate package really hit me. It needed to be a proper solution, something clean and safe.
So, I built a package! A simple, open-source Laravel package that lets you log in as any user with just a bit of magic in the URL. No more endless login forms, just pure development bliss.

Check out Slash Login repository on Github
And because I believe in sharing the good stuff, I put the code on GitHub. That way, everyone can see how it works, even improve it if they have ideas.
Here's the thing: SlashLogin is a developer package, so it uses a service provider. This fancy term basically means it adds a special feature to your Laravel app – a way to register a custom route. The cool part? You can configure this route however you like!
Ready? Here's how to install SlashLogin:
- Open your terminal and navigate to your Laravel project directory.
- Run this command:
composer require fahadyousafmahar/slash-login
- Publish the configuration file:
php artisan vendor:publish --tag="slash-login"
Now, let's configure it!
Open the config/slash-login.php
file and customize the following settings:
route
: This is the path segment used for login (default:login
).model
: The user model class to fetch data from (default:App\Models\User
).redirect_route
: The route to redirect to after login.guard
: The authentication guard to use (default:web
).
Bonus: You can even set additional session data after login like a "2FA verified" flag.
That's it! You're ready to conquer development with the power of SlashLogin. Now go forth and create amazing things, without the login form hassle!
If you're interested in my work or want to collaborate on a similar project, don't hesitate to reach out.