• Reading time ~ 2 min
  • 08.06.2022

Laravel Login Link is a Blade component to quickly login to your local environment.

After installing the login link package, logging in locally as an admin or normal user is as simple as adding the following blade snippet:

@env('local')
    <div class="space-y-2">
        <x-login-link email="[email protected]" label="Login as admin"/>
        <x-login-link email="[email protected]" label="Login as regular user"/>
    </div>
@endenv

By clicking a login link, you'll be logged in automatically without having to remember or enter any credentials. Your non-local environments won't render these links, but locally your login page might look like the following:

Spatie login link

According to Spatie's Freek Van der Herten, this package was imagined and created by Spatie to deal with seeded user credentials for various roles and a package built to share with the open-source community:

When developing an app with an admin section (or any non-public section), you'll likely seed test users to log in. In large teams that work on many different apps, it can be cumbersome to keep track of the right credentials. Is the user account "[email protected]", or "[email protected]", or even "[email protected]"? Is that password "password", "secret", or something else? How do I log in with a user that has a different role?

This package solves that problem by offering a component to render a login link. When clicked, you will be logged in.

Freek wrote a detailed introductory post on this package if you'd like to learn more about the background and use-case of this package. You can also learn more about setting up this package and view the source code on GitHub.

Comments

No comments yet
Yurij Finiv

Yurij Finiv

Full stack

ABOUT

Professional Fullstack Developer with extensive experience in website and desktop application development. Proficient in a wide range of tools and technologies, including Bootstrap, Tailwind, HTML5, CSS3, PUG, JavaScript, Alpine.js, jQuery, PHP, MODX, and Node.js. Skilled in website development using Symfony, MODX, and Laravel. Experience: Contributed to the development and translation of MODX3 i...

About author CrazyBoy49z
WORK EXPERIENCE
Contact
Ukraine, Lutsk
+380979856297