承接 osenco/filament-subscriptions 相关项目开发

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

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

osenco/filament-subscriptions

Composer 安装命令:

composer require osenco/filament-subscriptions

包简介

Manage subscriptions and feature access with customizable plans in FilamentPHP

README 文档

README

Screenshot

Filament Subscriptions

Latest Stable Version License Downloads

Manage subscriptions and feature access with customizable plans in FilamentPHP

thanks for Laravel Subscriptions you can review it before use this package.

Screenshots

Tenant Menu User Menu Billing Page Change Subscription Modal Plans Edit Plan Create Feature Features Subscriptions Create Subscription Cancel Modal

Features

  • Manage plans
  • Manage features
  • Manage subscriptions
  • multi-tenancy support
  • Native Filament subscriptions support
  • Subscription Middleware
  • Subscription Page like Spark
  • Subscription Events
  • Subscription Facade Hook
  • Subscription Webhooks
  • Subscription Payments Integrations

Installation

composer require tomatophp/filament-subscriptions

we need the Media Library plugin to be installed and migrated you can use this command to publish the migration

php artisan vendor:publish --provider="Spatie\MediaLibrary\MediaLibraryServiceProvider" --tag="medialibrary-migrations"

now you need to publish your migrations

php artisan vendor:publish --provider="Laravelcm\Subscriptions\SubscriptionServiceProvider"

after that please run this command

php artisan filament-subscriptions:install

finally register the plugin on /app/Providers/Filament/AdminPanelProvider.php

->plugin(\TomatoPHP\FilamentSubscriptions\FilamentSubscriptionsPlugin::make())

Using

now on your User.php model or any auth model you like you need to add this trait

namespace App\Models;

use Laravelcm\Subscriptions\Traits\HasPlanSubscriptions;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use HasPlanSubscriptions;
}

To configure the billing provider for your application, use the FilamentSubscriptionsProvider:

use TomatoPHP\FilamentSubscriptions\FilamentSubscriptionsProvider;
use TomatoPHP\FilamentSubscriptions\Filament\Pages\Billing;
use Filament\Panel;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->pages([
            Billing::class
        ])
        ->tenantBillingProvider(new FilamentSubscriptionsProvider());
}

This setup allows users to manage their billing through a link in the tenant menu.

Requiring a Subscription

To enforce a subscription requirement for any part of your application, use the requiresTenantSubscription() method:

use Filament\Panel;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->requiresTenantSubscription();
}

Users without an active subscription will be redirected to the billing page.

Register New Subscriber Type

you can register new subscriber type by using this code

use TomatoPHP\FilamentSubscriptions\Facades\FilamentSubscriptions;

public function boot()
{
    FilamentSubscriptions::register(
        \TomatoPHP\FilamentSubscriptions\Services\Contracts\Subscriber::make()
            ->name('User')
            ->model(\App\Models\User::class)
    );
}

Use Events

we add events everywhere on the subscription process and here is the list of events

  • TomatoPHP\FilamentSubscriptions\Events\CancelPlan
  • TomatoPHP\FilamentSubscriptions\Events\ChangePlan
  • TomatoPHP\FilamentSubscriptions\Events\RequestPlan
  • TomatoPHP\FilamentSubscriptions\Events\SubscribePlan

all events have the same payload

return [
    "old" => //Plan,
    "new" => //Plan,
    "subscription" => //Subscription,
]

Use Facade Hook

you can use the facade hook to add your custom logic to the subscription process

use TomatoPHP\FilamentSubscriptions\Facades\FilamentSubscriptions;

FilamentSubscriptions::afterSubscription(function (array $data){
    // your logic here
});

FilamentSubscriptions::afterRenew(function (array $data){
    // your logic here
});

FilamentSubscriptions::afterChange(function (array $data){
    // your logic here
});

FilamentSubscriptions::afterCanceling(function (array $data){
    // your logic here
});

Publish Assets

you can publish config file by use this command

php artisan vendor:publish --tag="filament-subscriptions-config"

you can publish views file by use this command

php artisan vendor:publish --tag="filament-subscriptions-views"

you can publish languages file by use this command

php artisan vendor:publish --tag="filament-subscriptions-lang"

Other Filament Packages

Checkout our Awesome TomatoPHP

osenco/filament-subscriptions 适用场景与选型建议

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

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-24