sakib-1996/auth-admin
Composer 安装命令:
composer require sakib-1996/auth-admin
包简介
A self-contained Laravel authentication and admin dashboard package with login, registration, and a Tailwind-powered UI.
README 文档
README
A self-contained Laravel package that provides authentication (login, register, logout) and a Tailwind CSS admin dashboard UI.
Requirements
- PHP 8.2+
- Laravel 11, 12, or 13
- Node.js 18+ and npm (required to build frontend assets)
- A
userstable and User model in your Laravel application
Installation
Install via Composer:
composer require sakib-1996/auth-admin
Build and publish frontend assets:
php artisan auth-admin:install
This command runs npm install, npm run build inside the package, and copies compiled assets to public/vendor/auth-admin.
Optional: publish config
php artisan vendor:publish --tag=auth-admin-config
Optional: publish views for customization
php artisan vendor:publish --tag=auth-admin-views
Published views are placed in resources/views/vendor/auth-admin.
Usage
After installation, the following routes are available (default prefix auth-admin):
| Method | URI | Name |
|---|---|---|
| GET | /auth-admin/login |
auth-admin.login |
| POST | /auth-admin/login |
— |
| GET | /auth-admin/register |
auth-admin.register |
| POST | /auth-admin/register |
— |
| POST | /auth-admin/logout |
auth-admin.logout |
| GET | /auth-admin |
auth-admin.dashboard |
Visit /auth-admin/login to sign in.
Configuration
Configuration file: config/auth-admin.php (optional, publish first)
| Option | Default | Description |
|---|---|---|
route_prefix |
auth-admin |
URL prefix for all package routes |
middleware |
['web'] |
Middleware stack applied to package routes |
guard |
web |
Authentication guard |
user_model |
null |
User model class (falls back to auth.providers.users.model) |
users_table |
null |
Users table name (falls back to model table) |
redirect_after_login |
auth-admin.dashboard |
Route name after login |
redirect_after_logout |
auth-admin.login |
Route name after logout |
Using your existing User model
By default, the package uses your application's User model from config/auth.php. No extra setup is required if you already have a standard Laravel users table with name, email, and password columns.
Ensure your User model hashes passwords, for example:
protected function casts(): array { return [ 'password' => 'hashed', ]; }
Blade components
| Component | Description |
|---|---|
<x-auth-admin-guest-layout> |
Guest layout for login/register |
<x-auth-admin-layout> |
Admin dashboard layout |
<x-auth-admin-input> |
Reusable form input with validation errors |
<x-auth-admin-sidebar> |
Sidebar navigation |
<x-auth-admin-navbar> |
Top navigation bar |
Screenshots
Troubleshooting
Assets not loading
Run:
php artisan auth-admin:install
Ensure public/vendor/auth-admin/app.css and app.js exist.
Route [login] not defined
This package uses auth-admin.login, not Laravel's default login route. Protected package routes use auth-admin.auth middleware which redirects to the correct login route automatically.
Registration fails
Verify your users table exists and your User model has name, email, and password in $fillable (or uses #[Fillable]).
npm build fails
Ensure Node.js 18+ is installed and run the install command from your Laravel project root.
Upgrade guide
1.0.0
Initial stable release. Requires running php artisan auth-admin:install after install or upgrade.
Development
composer install
composer test
composer format
composer analyse
License
MIT © Abdullah Mohammad Sakib. See LICENSE.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-06