mayakhan719/filament-saas-plugin 问题修复 & 功能扩展

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

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

mayakhan719/filament-saas-plugin

Composer 安装命令:

composer require mayakhan719/filament-saas-plugin

包简介

Filement SaaS is a package that provides a set of tools and features to help you build multi-tenant SaaS applications using the Filament admin panel in Laravel.

README 文档

README

A Laravel + Filament plugin to add SaaS multi-tenant features like plans, subscriptions, payments, and more. This package includes both admin and client panel logic, designed to streamline multi-tenant SaaS application development using Filament.

Supports PSR-4 Autoloading, PSR-12 Coding Standards, and is designed to work within Laravel's service container and event systems.

Alt text Alt text Alt text Alt text

📦 Installation

1. Laravel Subscriptions Library

Install Laravel Subscriptions:
GitHub: laravelcm/laravel-subscriptions

composer require laravelcm/laravel-subscriptions
php artisan vendor:publish --provider="Laravelcm\Subscriptions\SubscriptionServiceProvider"
php artisan migrate

2. Spatie Media Library

Used for managing media uploads (e.g., plan images, user uploads) GitHub: spatie/laravel-medialibrary

composer require spatie/laravel-medialibrary
php artisan vendor:publish --provider="Spatie\MediaLibrary\MediaLibraryServiceProvider" --tag="medialibrary-migrations"
php artisan migrate

3. Filament SaaS Plugin

composer require maya/filament-saas-plugin
php artisan vendor:publish --provider="Maya\FilamentSaasPlugin\FilamentSaasPluginServiceProvider"

🧩 Panel Setup

Admin Panel Provider Add the following to your Admin PanelProvider:

->plugin(new FilamentSaasAdminPlugin)

Includes: ✅ Subscription Resource

✅ Payment Resource (with gateway relation manager)

✅ Plan Resource (with features relation manager)

⚠️ Do not include ->login() or ->register() in the super admin panel.

Client Panel Provider Add the following to your Client PanelProvider:

->plugin(new FilamentSaasClientPlugin)

Includes:

✅ Billing & Payment pages

✅ Livewire components for subscription and payment

✅ Middleware for subscription checks

✅ Custom single-page login

👤 The client panel is meant to be the default panel.

💳 Payment Integration

Inside App\Providers\AppServiceProvider → boot() method, define the following:

FilamentSubscriptions::beforeSubscription(function ($data) {
    $this->PaymentPage($data, SubscribePlan::class);
});
FilamentSubscriptions::beforeRenew(function ($data) {
    $this->PaymentPage($data, RenewPlan::class);
});
FilamentSubscriptions::beforeChange(function ($data) {
    $this->PaymentPage($data, ChangePlan::class);
});

And define the PaymentPage() method:

private function PaymentPage($data, $event)
{
    return redirect()->to(
        FilamentPayments::pay(
            data: PaymentRequest::make(Plan::class)
                ->model_id($data['new']->id)
                ->team_id($data['team_id'])
                ->event($event)
                ->currency('USD')
                ->amount($data['new']->price)
                ->details('Subscription Payment')
                ->success_url(url('/client'))
                ->cancel_url(url('/client'))
                ->customer(
                    PaymentCustomer::make('John Doe')
                        ->email('john@gmail.com')
                        ->mobile('+201207860084')
                )
                ->billing_info(
                    PaymentBillingInfo::make('123 Main St')
                        ->area('Downtown')
                        ->city('Cairo')
                        ->state('Cairo')
                        ->postcode('12345')
                        ->country('EG')
                )
                ->shipping_info(
                    PaymentShippingInfo::make('123 Main St')
                        ->area('Downtown')
                        ->city('Cairo')
                        ->state('Cairo')
                        ->postcode('12345')
                        ->country('EG')
                )
        )
    );
}

🔔 After Payment Callback

After a successful payment, you may:

Send database or broadcast notifications

Notify all super admins

Example:

$super_admins = User::where('is_super', true)->get();

👤 User Model Setup

In your User.php model:

use Maya\FilamentSaasPlugin\Contracts\SaasUser;
use Maya\FilamentSaasPlugin\Traits\HasSaasFeatures;

class User extends Authenticatable implements SaasUser
{
    use HasSaasFeatures;

    protected $fillable = [
        'is_super',
        'latest_team_id',
    ];
}

🧑‍🤝‍🧑 Team Model Setup

Create your Team.php model and extend from the base model:

use Maya\FilamentSaasPlugin\Models\Team as BaseTeam;

class Team extends BaseTeam
{
    // Add additional relations if needed
}

To support multi-tenancy, configure the necessary relations in this model. 📖 See Filament Multi-Tenancy Docs

✅ Features Summary ✔ Admin & Client panel plugins

✔ Payment integration hooks

✔ Subscription lifecycle events

✔ Filament Resources for Plans, Features, Subscriptions

✔ Media uploads (via Spatie)

✔ Laravel Subscriptions Support

✔ Multi-tenancy ready

✔ Super admin control

📚 Resources Laravel: https://laravel.com

FilamentPHP: https://filamentphp.com

Laravel Subscriptions: https://github.com/laravelcm/laravel-subscriptions

Spatie Media Library: https://github.com/spatie/laravel-medialibrary

📄 License The MIT License (MIT). Please see the LICENSE file for more information.

Let me know if you'd like the corresponding `composer.json`, a `CONTRIBUTING.md`, or GitHub Actions CI/CD workflow example to go along with it.

mayakhan719/filament-saas-plugin 适用场景与选型建议

mayakhan719/filament-saas-plugin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 07 月 02 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「subscription」 「laravel」 「saas」 「multi-tenant」 「spatie」 「media-library」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

围绕 mayakhan719/filament-saas-plugin 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

与 mayakhan719/filament-saas-plugin 相关的其它包

同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-02