nikfedorov/auto-login 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nikfedorov/auto-login

最新稳定版本:v1.0.0

Composer 安装命令:

composer require nikfedorov/auto-login

包简介

Auto-login middleware for Laravel — logs in the first database user in allowed environments during development.

README 文档

README

Middleware that automatically logs in the first database user in allowed environments — skip the login screen during development.

If no user exists yet, the request passes through unauthenticated. Run your seeders first.

Requirements

  • PHP 8.2+
  • Laravel 11 / 12 / 13

Installation

composer require nikfedorov/auto-login

Then register the middleware:

php artisan auto-login:install

This adds the middleware to bootstrap/app.php:

->withMiddleware(function (Middleware $middleware): void {
    $middleware->append(AutoLoginLocal::class);
})

You can also register it manually instead of running the command.

Optionally publish the config:

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

Configuration

Env variable Default Description
AUTOLOGIN_ENABLED true Enable or disable auto-login globally
AUTOLOGIN_ENVIRONMENTS local Comma-separated list of allowed environments

How it works

On each request:

  1. Skips if the user is already authenticated.
  2. Skips if auto-login.enabled is false.
  3. Skips if the current APP_ENV is not in auto-login.environments.
  4. Resolves the user model from auth.providers.users.model, grabs the first record, and logs them in.

In any environment not listed in AUTOLOGIN_ENVIRONMENTS (e.g. production, staging) the middleware is a no-op.

Testing

composer test

统计信息

  • 总下载量: 2
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固