mariojgt/masterkey
Composer 安装命令:
composer require mariojgt/masterkey
包简介
MasterKey - Minimal QR-based auth for Laravel + Ionic (no Sanctum).
README 文档
README
QR-based login bridge between your Laravel app and the MasterKey mobile app (Ionic). No Sanctum. Minimal and production-ready.
Highlights
- Permanent or expiring API tokens (config).
- Pre-login QR → 6-digit code → app token.
- Web/admin login via QR scanned by authenticated app.
- Logout QR triggers event/callback for your custom logic.
- Tiny
auth.tokenmiddleware for Bearer tokens.
Install
composer require mariojgt/masterkey:* php artisan vendor:publish --provider="Mariojgt\MasterKey\MasterKeyServiceProvider" --tag=config php artisan migrate
Add a path repo if using from source:
"repositories": [{ "type": "path", "url": "packages/masterkey" }]
Config (config/masterkey.php)
token_expires_days→ null = never expire (default).post_login_redirect→ where browser goes after QR approval.logout_callback_route→ optional HTTP callback you implement.qr_prefix→ defaultmkey:.
Routes
- Public:
GET /login-qr→ Blade page that displays QR and polls status.GET /api/web/status?session_id=→ polled by the page.POST /api/app/request-code{email}→ returns{nonce, code, qr_payload}(demo returns code).POST /api/app/verify{nonce, code}→ returns{token, user}.
- Authenticated (with Bearer token via app):
POST /api/web/approve{session_id}→ approves web login.POST /api/logout-qr→ fires event for your logout logic.
Protect API
Route::middleware(\Mariojgt\MasterKey\Http\Middleware\AuthToken::class) ->get('/api/me', fn() => auth()->user());
Client app
You can download here MasterKey app.
mariojgt/masterkey 适用场景与选型建议
mariojgt/masterkey 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 79 次下载、GitHub Stars 达 2, 最近一次更新时间为 2025 年 09 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 mariojgt/masterkey 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mariojgt/masterkey 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 79
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-09-15