Subscriptions
Manage subscriptions and feature access with customizable plans in FilamentPHP
Author:
Abdelmjid Saber
Documentation
- Screenshots
- Features
- Installation
- Using
- Requiring a Subscription
- Register New Subscriber Type
- Use custom Billing page
- Use Events
- Use Facade Hook
- Publish Assets
- Other Filament Packages

Manage subscriptions and feature access with customizable plans in FilamentPHP
thanks for Laravel Subscriptions you can review it before use this package.
#Screenshots

#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 custom Billing page
You can create your own billing class and register it in config/laravel-subscriptions.php
'pages' => [
'billing' => Billing::class,
]
#Use Events
we add events everywhere on the subscription process and here is the list of events
TomatoPHP\FilamentSubscriptions\Events\CancelPlanTomatoPHP\FilamentSubscriptions\Events\ChangePlanTomatoPHP\FilamentSubscriptions\Events\RequestPlanTomatoPHP\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
The author
From the same author
Featured Plugins
A selection of plugins curated by the Filament team
Custom Dashboards
Let your users build and share their own dashboards with a drag-and-drop interface. Define your data sources in PHP and let them do the rest.
Filament
Advanced Tables (formerly Filter Sets)
Supercharge your tables with powerful features like user-customizable views, quick filters, multi-column sorting, advanced table searching, convenient view management, and more. Compatible with Resource Panel Tables, Relation Managers, Table Widgets, and Table Builder!
Kenneth Sese
Data Lens
Advanced Data Visualization for Laravel Filament - a premium reporting solution enabling custom column creation, sophisticated filtering, and enterprise-grade data insights within admin panels.
Padmission