承接 saadmughal/admin-auth-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

saadmughal/admin-auth-php

Composer 安装命令:

composer require saadmughal/admin-auth-php

包简介

Admin authentication package for Laravel with Firebase notifications

README 文档

README

Latest Version on Packagist Total Downloads License PHP Version Require

A complete Admin Authentication package for Laravel. Features include:

  1. 🔐 Admin login & registration

  2. 🔑 Password reset & email verification

  3. 🔔 Firebase push notifications for admins

  4. ⚡ Ready-to-use routes, controllers, and views

🚀 Installation & Setup

1. Install via Composer

composer require saadmughal/admin-auth-php

2. Register Service Provider

This package uses manual provider registration (to avoid errors on removal).

Laravel 9 & 10

Edit config/app.php and add to the providers array:

Mughal\AdminAuth\AdminAuthServiceProvider::class,

Laravel 11 & above

Edit bootstrap/providers.php:

return [
    // other providers...
    Mughal\AdminAuth\AdminAuthServiceProvider::class,
];

3. Run Migrations

php artisan migrate

4. Add Guard & Provider

Add admin guard and provider in config/auth.php:

'guards' => [
    'admin' => [
        'driver' => 'session',
        'provider' => 'admins',
    ],
],
'providers' => [
    'admins' => [
        'driver' => 'eloquent',
        'model' => Mughal\AdminAuth\Models\Admin::class,
    ],
],

5. Dashboard Redirect

By default, after successful login, admins are redirected to /admin.
You can change this in config/adminauth.php:

'redirect_to' => '/dashboard',

After installing and migrating, you must define your own admin dashboard route.

Add this to routes/web.php in your Laravel project:

Route::middleware('auth:admin')->group(function () {
    Route::get('/dashboard', function () {
        return view('admin.dashboard'); 
    });
});

6. Publish Config

After installing, publish the config file:

php artisan vendor:publish --provider="Mughal\AdminAuth\AdminAuthServiceProvider" --tag=config

Firebase Notifications (Optional)

If you want to send notifications to admins, configure Firebase:

  1. Add your Firebase JSON path in .env:
ADMIN_FIREBASE_JSON=/full/path/to/firebase_project.json
  1. Save the admin’s FCM token when they log in
  2. If you have added the Firebase JSON file path in your .env file and the FCM token is being stored in the database, you can use the below function to send notifications to admins.
use Mughal\AdminAuth\Models\Admin;

$admin = Admin::first();
$data = [
    'title' => 'New Alert',
    'body' => 'You have a new notification!',
    'description' => 'Notification details',
    'type' => 'info'
];
$message = "Check your dashboard";

$admin->sendNotification($admin->id, $data, $message);

Visit in your browser:

http://localhost:8000/admin/login
http://localhost:8000/admin/register

🗑️ Removal / Uninstall

To uninstall cleanly without errors:

  1. Remove provider entry 1.1 Laravel 9 & 10 → remove from config/app.php 1.2 Laravel 11 → remove from bootstrap/providers.php

  2. Remove the package

composer remove saadmughal/admin-auth-php
  1. Clear caches
php artisan config:clear
php artisan route:clear
php artisan view:clear
php artisan cache:clear

saadmughal/admin-auth-php 适用场景与选型建议

saadmughal/admin-auth-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 08 月 18 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 saadmughal/admin-auth-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 saadmughal/admin-auth-php 我们能提供哪些服务?
定制开发 / 二次开发

基于 saadmughal/admin-auth-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-08-18