›
›
›
  1. docs
  2. ›
  3. byrcsc/laravel-dev-login
1.x
Browse documentationOpenClose

Getting started

  • Introduction
  • Installation and setup
  • Quick start

Core concepts

  • Profiles
  • Safety gates
  • The login flow

Extending

  • User resolvers
  • Tenancy
  • Routes and redirects
  • Customizing the page

Reference

  • Configuration
  • Testing
  • Troubleshooting

Getting started

  • Introduction
  • Installation and setup
  • Quick start

Core concepts

  • Profiles
  • Safety gates
  • The login flow

Extending

  • User resolvers
  • Tenancy
  • Routes and redirects
  • Customizing the page

Reference

  • Configuration
  • Testing
  • Troubleshooting

byrcsc/laravel-dev-login · 1.x

Configuration.

Every key in config/dev-login.php, its type, its default, and what reads it.

php artisan vendor:publish --tag=dev-login-config

config/dev-login.php holds nine keys. Five of them are safety gates, three are seams for classes of your own, and one is the profile list.

return [
    'enabled' => (bool) env('DEV_LOGIN_ENABLED', false),

    'environments' => ['local', 'testing'],

    'allowed_hosts' => ['localhost', '127.0.0.1', '*.test'],

    'path' => 'dev-login',

    'middleware' => ['web'],

    'profiles' => [],

    'resolver' => null,

    'tenant_resolver' => null,

    'default_redirect' => null,
];

The file contains no closures anywhere, so it survives config:cache. Every seam in it is a class-string for that reason.

Reference

KeyTypeDefaultPurpose
enabledboolfalseThe master switch, read from DEV_LOGIN_ENABLED
environmentslist of strings['local', 'testing']Environments the package may run in; production is refused
allowed_hostslist of strings['localhost', '127.0.0.1', '*.test']Hosts the page answers on, checked per request
pathnon-empty stringdev-loginThe URI both routes live under
middlewarearray['web']Applied to both routes, ahead of the host gate
profilesarray keyed by name[]The profiles the page shows
resolverclass-string or nullnullDefault UserResolver; null uses FindUserByEmail
tenant_resolverclass-string or nullnullTenantResolver for tenant-bound profiles
default_redirectstring or nullnullFallback destination; null falls through to /

enabled

Off by default, and separate from environments on purpose. Both have to say yes. Setting it while APP_ENV=production throws DevLoginEnabledInProduction at boot.

environments

Matched case-sensitively against app()->environment(). Adding production here does not work, because the production check is asked separately.

A value this key cannot read as a list is treated as an empty list, which shuts the gate.

allowed_hosts

Entries are exact hosts or leading-wildcard patterns. *.test matches acme.test and tenant.acme.test, but not test. A bare * matches nothing, and an empty list allows nothing. Matching is case-insensitive.

path

Must be a non-empty string. Anything else throws InvalidConfiguration::path while routes register. The route names stay dev-login.show and dev-login.attempt whatever the path is.

middleware

Must be an array. web is required in practice: the session guard needs a session and the POST route relies on that group for CSRF. The host gate is appended after this list.

profiles

Keyed by the route parameter. Each value is an array accepting label, email, guard, remember, tenant, redirect, resolver, and fire_login_event. Any other key throws. See Profiles.

resolver and tenant_resolver

Class-strings implementing UserResolver and TenantResolver. Both are built through the container, and both throw InvalidConfiguration naming the key when the class does not implement the contract.

tenant_resolver is only ever reached by a profile that names a tenant.

default_redirect

Third in the redirect order, after the profile's own redirect and the session's intended URL.

Environment variables

VariableReads intoDefault
DEV_LOGIN_ENABLEDenabledfalse

This is the only variable the package defines. Everything else is edited in the config file, where the change is visible in a diff.

Publish tags

TagWrites
dev-login-configconfig/dev-login.php
dev-login-viewsresources/views/vendor/dev-login/ (page and component)

The package ships no migrations, because it writes no schema of its own.

Classes and contracts

ClassRole
ByRcsc\LaravelDevLogin\GatekeeperAnswers passes(), mustRefuseToBoot(), hostIsAllowed()
ByRcsc\LaravelDevLogin\ProfileRepositoryall(), groupedByTenant(), find()
ByRcsc\LaravelDevLogin\Authenticatorlogin(Profile): Authenticatable
ByRcsc\LaravelDevLogin\ProfileReadonly value object, hasTenant()
ByRcsc\LaravelDevLogin\Contracts\UserResolverresolve(Profile): ?Authenticatable
ByRcsc\LaravelDevLogin\Contracts\TenantResolvermakeCurrent(Profile): void
ByRcsc\LaravelDevLogin\Resolvers\FindUserByEmailThe shipped user resolver
ByRcsc\LaravelDevLogin\Http\Middleware\EnsureHostIsAllowedThe host gate, aliased dev-login.host

DevLoginServiceProvider::HOST_MIDDLEWARE holds the alias string, so a route of your own can reference it without repeating the literal.

What to read next

  • Safety gates for what the first five keys refuse and how.
  • Profiles for the shape of each entry in profiles.
  • Troubleshooting for the exceptions these keys throw.
PreviousCustomizing the pageNextTesting
View source

On this page

  1. Reference
  2. enabled
  3. environments
  4. allowed_hosts
  5. path
  6. middleware
  7. profiles
  8. resolver and tenant_resolver
  9. default_redirect
  10. Environment variables
  11. Publish tags
  12. Classes and contracts
  13. What to read next