fluttersdk/magic-starter-laravel
Composer 安装命令:
composer require fluttersdk/magic-starter-laravel
包简介
Magic Framework Laravel backend starter package.
README 文档
README
Magic Starter Laravel
Pre-built Auth, Profile, Teams & Notifications API for Laravel.
12 opt-in features — every action overridable.
Website · Docs · Packagist · Issues · Discussions
Alpha —
magic-starter-laravelis under active development. APIs may change between minor versions until1.0.0.
Why Magic Starter Laravel?
Stop rebuilding authentication, profile management, and team features from scratch in every Laravel project. The same controllers, the same validation, the same service bindings — over and over.
Magic Starter Laravel gives you a production-ready JSON API for auth, profile, teams, and notifications out of the box. Everything is config-driven with 12 opt-in feature toggles. Every action is overridable via contract bindings — swap any business logic from your host app without touching the package.
Config-driven API starter kit. Enable only what you need. Override any action. Ship faster.
Features
| Feature | Description | |
|---|---|---|
| 🔑 | Authentication | Login, register, forgot/reset password, social login |
| 🛡️ | Two-Factor Auth | Enable/disable 2FA with QR code, OTP confirm, recovery codes |
| 👤 | Profile Management | Photo upload, email/password change, account deletion |
| 👥 | Teams | Create, switch, invite members, manage roles, team photos |
| 🔔 | Notifications | Listing, unread count, mark read/unread, preference matrix |
| 📱 | OTP Login | Phone-based authentication with send/verify flow |
| 👻 | Guest Auth | Guest-only login without a registered account |
| ✉️ | Email Verification | Signed verification URL, resend notification |
| 📰 | Newsletter | Subscribe/unsubscribe toggle per user |
| 🌐 | Timezones | Timezone listing API for extended profile |
| 📷 | Profile Photos | Upload and delete for users and teams |
| 🖥️ | Sessions | Active session listing and revocation |
Quick Start
1. Install the package
composer require fluttersdk/magic-starter-laravel
2. Publish configuration and run migrations
php artisan vendor:publish --tag=magic-starter-config php artisan migrate
3. Prepare your User model
Add the required traits to your User model:
use FlutterSdk\MagicStarter\Traits\HasTeams; use FlutterSdk\MagicStarter\Traits\HasGuestSupport; use FlutterSdk\MagicStarter\Traits\HasProfilePhoto; use FlutterSdk\MagicStarter\Traits\HasNotifications; use FlutterSdk\MagicStarter\Support\ConditionallyUsesUuids; class User extends Authenticatable { use ConditionallyUsesUuids; use HasTeams; use HasGuestSupport; use HasProfilePhoto; use HasNotifications; }
That's it — auth, profile, teams, and notifications API endpoints are ready to use.
Feature Toggles
All 12 features are opt-in. Enable them by uncommenting in config/magic-starter.php:
| Toggle Key | Description |
|---|---|
teams |
Team creation, switching, member invitations, role management |
profile-photos |
Profile photo upload and display for users and teams |
sessions |
Active session listing and revocation |
social-login |
Social authentication via Socialite providers |
newsletter-subscription |
Newsletter subscribe/unsubscribe toggle |
extended-profile |
Extended profile fields: phone, timezone, language, locale |
notifications |
Notification listing, unread count, read/unread, preferences |
two-factor-authentication |
Two-factor auth with QR code, OTP confirmation, recovery codes |
email-verification |
Signed email verification URL and resend notification |
guest-auth |
Guest-only authentication without a registered account |
phone-otp |
Phone-based OTP send/verify login flow |
timezones |
Timezone listing API endpoint |
Architecture
Request → Route (feature-gated, rate-limited)
→ Controller (thin — injects contract)
→ Contract interface
→ Action (business logic, validator, model resolution)
→ Model (ConditionallyUsesUuids, dynamic resolution)
Key patterns:
| Pattern | Implementation |
|---|---|
| Contract-Action | Controllers inject interfaces from Contracts/, bound in ServiceProvider |
| Feature Toggles | Features::enabled() gates routes, logic, and resource fields |
| Dynamic Model Resolution | MagicStarter::userModel(), ::teamModel() — never hardcode classes |
| Service Provider | Contract bindings, route registration, rate limiters, password reset URL |
| Rate Limiters | Per-endpoint throttle groups: auth, register, social, 2FA, OTP, etc. |
Documentation
| Document | Description |
|---|---|
| Installation | Adding the package, publishing config, running migrations |
| Configuration | Config file reference and feature toggles |
| Authentication | Login, register, forgot/reset password, social login, OTP |
| Teams | Team CRUD, switching, invitations, member roles |
| Profile | Profile updates, photo upload, password change, account deletion |
| Two-Factor Auth | 2FA enable/disable, QR code, confirm, recovery codes |
| Notifications | Listing, unread count, mark read, preferences |
| Service Provider | Contract bindings, route registration, rate limiters |
| Action Contracts | Overriding business logic via singleton binding |
| Models | Dynamic resolution, UUID support, traits |
Contributing
Contributions are welcome! Please see the issues page for open tasks or to report bugs.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Write tests following the TDD flow — red, green, refactor
- Ensure all checks pass:
composer test,composer lint,composer analyse - Submit a pull request
License
Magic Starter Laravel is open-sourced software licensed under the MIT License.
Built with care by FlutterSDK
If Magic Starter Laravel helps your project, consider giving it a star on GitHub.
fluttersdk/magic-starter-laravel 适用场景与选型建议
fluttersdk/magic-starter-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 453 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 03 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「auth」 「laravel」 「profile」 「starter」 「Teams」 「sanctum」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 fluttersdk/magic-starter-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 fluttersdk/magic-starter-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 fluttersdk/magic-starter-laravel 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Laravel Multiauth package
A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.
A module for Pluf to manage user profiles and user accounts
This package provides a flexible way to add Role-based Permissions to Laravel 6.x
Email Toolkit Plugin for CakePHP
The Flarum extension that allows users to private their profiles.
统计信息
- 总下载量: 453
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 35
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-24