eightynine/filament-subscription

Tenant subscriptions, entitlements, usage tracking, and billing (Paddle + Tanzania custom providers) for Filament v4.

Installs: 6

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/eightynine/filament-subscription

4.0.1 2026-01-16 10:56 UTC

This package is auto-updated.

Last update: 2026-01-16 11:00:00 UTC


README

Tenant subscriptions, entitlements, usage tracking, and billing UI for Filament v4 (Laravel 12).

This plugin is installed in this project as a path repository (plugins/eightynine/filament-subscription).

Requirements

  • PHP 8.4+
  • Laravel 12+
  • Filament v4

Install (this repository)

This project already includes the path repository entry in the root composer.json:

{
  "repositories": [
    {
      "type": "path",
      "url": "plugins/eightynine/filament-subscription",
      "options": { "symlink": true }
    }
  ]
}

And the package requirement:

composer require eightynine/filament-subscription

If you add/update code in the plugin, run:

composer dump-autoload

Publish config

The package provides a config file you can publish:

php artisan vendor:publish --tag=filament-subscription-config

This will publish to:

  • config/filament-subscription.php

Run migrations

The plugin ships migrations under plugins/eightynine/filament-subscription/database/migrations and the service provider loads them automatically.

Run:

php artisan migrate

Set up features (entitlements)

This plugin supports code-defined features (synced into the DB) and/or seeded features.

Option A: Code-defined features (recommended)

  1. Create a registrar class in your app that implements Eightynine\FilamentSubscription\Features\FeatureRegistrar and returns an array of FeatureDefinition objects.
  2. Register that registrar class in config/filament-subscription.php:
'feature_registrars' => [
  App\Billing\BillingFeatureRegistrar::class,
],
  1. Sync the feature definitions into the database:
php artisan filament-subscription:sync-features

Option B: Seeded features (quick start)

This repository includes example seeders that create common quotas/modules:

php artisan db:seed --class=Database\\Seeders\\BillingFeatureSeeder
php artisan db:seed --class=Database\\Seeders\\BillingPlanSeeder

Set up plans (pricing)

Plans + entitlements live in the billing tables:

  • billing_plans
  • billing_plan_prices
  • billing_plan_feature_entitlements

You can create/update these via:

  • Seeders (see above)
  • Your own admin UI/resources (if you expose the package models via Filament)

Ensure plugin views are included in Tailwind / Filament theme builds

Filament pages/widgets in this plugin render Blade views under:

  • plugins/eightynine/filament-subscription/resources/views/**

Since Tailwind v4 uses file scanning via @source, you must ensure those plugin view paths are included, otherwise Tailwind may purge classes used by the plugin UI.

Add this @source line to your Filament theme CSS:

  • resources/css/filament/app/theme.css
@source '../../../../plugins/eightynine/filament-subscription/resources/views/**/*';

Then rebuild assets:

npm run build

Register the Filament plugin

Register the plugin in your Filament panel provider (example):

use Eightynine\FilamentSubscription\FilamentSubscriptionPlugin;

$panel
    ->plugins([
        FilamentSubscriptionPlugin::make(),
    ]);

Where does the UI show?

The ManageSubscription page is wired to appear in the User Menu (top-right profile dropdown) by default.

If you also want it in the sidebar navigation, set the config value:

  • filament-subscription.ui.manage_subscription.navigation_menu => true

Tenant model setup (Company)

This plugin is tenant-aware via Filament::getTenant().

Your tenant model (commonly App\Models\Company) should:

  • Use the trait: Eightynine\FilamentSubscription\Traits\HasSubscription
  • Be configured as your Filament tenant model (panel tenancy)

The trait provides:

  • subscription() morph-one relationship
  • getFeatureLimit($key) and canConsume($featureKey, $currentUsage)
  • Convenience helpers used by the billing UI:
    • onTrial()
    • trialEndsAt()
    • $company->billablePlan (accessor)

Webhooks

Webhook routes are loaded from:

  • plugins/eightynine/filament-subscription/routes/webhooks.php

Configure your billing provider to send webhooks to the route(s) defined there.

Console commands

The package registers (when running in console):

  • SyncBillingFeaturesCommand (see src/Console/Commands)

You can list all commands with:

php artisan list

What the plugin provides

  • Billing models (plans, subscriptions, invoices, payments, usage records)
  • Policies for package resources/models
  • A customer-facing Filament page:
    • Eightynine\FilamentSubscription\Filament\Pages\ManageSubscription
  • Supporting Filament widgets (used on the page):
    • InvoicesTable
    • PaymentsTable
    • CompanySubscriptionStats

Usage

Open Filament, switch/select a tenant (Company), then use:

  • User Menu �7 Billing & Subscription

Tabs include:

  • Status
  • Pricing
  • Invoices
  • Payments
  • Payment Methods

Notes / Troubleshooting

  • Views not found: ensure FilamentSubscriptionServiceProvider loads views and you ran composer dump-autoload after changes.
  • Tenant is null: the billing UI expects Filament::getTenant() to be set (panel tenancy configured).
  • Livewire component not found: ensure the widget class exists under the namespace referenced in the Blade view, and autoload has been refreshed.