{"id":22238547,"url":"https://github.com/tomatophp/filament-subscriptions","last_synced_at":"2025-04-05T14:04:52.369Z","repository":{"id":254270551,"uuid":"845605069","full_name":"tomatophp/filament-subscriptions","owner":"tomatophp","description":"Manage your subscriptions Like Spark for FilamentPHP ","archived":false,"fork":false,"pushed_at":"2025-01-08T09:27:48.000Z","size":2280,"stargazers_count":51,"open_issues_count":5,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T13:08:40.596Z","etag":null,"topics":["filament-plugin","payments","subscriptions","tomatophp"],"latest_commit_sha":null,"homepage":"https://tomatophp.com/en/open-source/filament-subscriptions","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomatophp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["3x1io","megoxv"]}},"created_at":"2024-08-21T15:09:31.000Z","updated_at":"2025-03-06T01:12:19.000Z","dependencies_parsed_at":"2025-03-06T03:09:01.484Z","dependency_job_id":"bd03158d-b234-4042-a108-83e82daf931b","html_url":"https://github.com/tomatophp/filament-subscriptions","commit_stats":null,"previous_names":["tomatophp/filament-subscriptions"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomatophp%2Ffilament-subscriptions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomatophp%2Ffilament-subscriptions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomatophp%2Ffilament-subscriptions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomatophp%2Ffilament-subscriptions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomatophp","download_url":"https://codeload.github.com/tomatophp/filament-subscriptions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247345850,"owners_count":20924102,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["filament-plugin","payments","subscriptions","tomatophp"],"created_at":"2024-12-03T03:16:59.720Z","updated_at":"2025-04-05T14:04:52.346Z","avatar_url":"https://github.com/tomatophp.png","language":"PHP","funding_links":["https://github.com/sponsors/3x1io","https://github.com/sponsors/megoxv"],"categories":[],"sub_categories":[],"readme":"![Screenshot](https://raw.githubusercontent.com/tomatophp/filament-subscriptions/master/arts/megoxv-tomato-subscriptions.jpg)\n\n# Filament Subscriptions\n\n[![Latest Stable Version](https://poser.pugx.org/tomatophp/filament-subscriptions/version.svg)](https://packagist.org/packages/tomatophp/filament-subscriptions)\n[![License](https://poser.pugx.org/tomatophp/filament-subscriptions/license.svg)](https://packagist.org/packages/tomatophp/filament-subscriptions)\n[![Downloads](https://poser.pugx.org/tomatophp/filament-subscriptions/d/total.svg)](https://packagist.org/packages/tomatophp/filament-subscriptions)\n\nManage subscriptions and feature access with customizable plans in FilamentPHP\n\nthanks for [Laravel Subscriptions](https://github.com/laravelcm/laravel-subscriptions) you can review it before use this package.\n\n## Screenshots\n\n![Tenant Menu](https://raw.githubusercontent.com/tomatophp/filament-subscriptions/master/arts/tenant-menu.png)\n![User Menu](https://raw.githubusercontent.com/tomatophp/filament-subscriptions/master/arts/user-menu.png)\n![Billing Page](https://raw.githubusercontent.com/tomatophp/filament-subscriptions/master/arts/billing-page.png)\n![Change Subscription Modal](https://raw.githubusercontent.com/tomatophp/filament-subscriptions/master/arts/change-subscription-modal.png)\n![Plans](https://raw.githubusercontent.com/tomatophp/filament-subscriptions/master/arts/plans.png)\n![Edit Plan](https://raw.githubusercontent.com/tomatophp/filament-subscriptions/master/arts/edit-plan.png)\n![Create Feature](https://raw.githubusercontent.com/tomatophp/filament-subscriptions/master/arts/create-feature.png)\n![Features](https://raw.githubusercontent.com/tomatophp/filament-subscriptions/master/arts/features.png)\n![Subscriptions](https://raw.githubusercontent.com/tomatophp/filament-subscriptions/master/arts/subscriptions.png)\n![Create Subscription](https://raw.githubusercontent.com/tomatophp/filament-subscriptions/master/arts/create-subscription.png)\n![Cancel Modal](https://raw.githubusercontent.com/tomatophp/filament-subscriptions/master/arts/cancel-modal.png)\n\n\n## Features\n\n- [x] Manage plans\n- [x] Manage features\n- [x] Manage subscriptions\n- [x] multi-tenancy support\n- [x] Native Filament subscriptions support\n- [x] Subscription Middleware\n- [x] Subscription Page like Spark\n- [x] Subscription Events\n- [x] Subscription Facade Hook\n- [ ] Subscription Webhooks\n- [ ] Subscription Payments Integrations\n\n## Installation\n\n```bash\ncomposer require tomatophp/filament-subscriptions\n```\n\nwe need the Media Library plugin to be installed and migrated you can use this command to publish the migration\n\n```bash\nphp artisan vendor:publish --provider=\"Spatie\\MediaLibrary\\MediaLibraryServiceProvider\" --tag=\"medialibrary-migrations\"\n```\n\nnow you need to publish your migrations\n\n```bash\nphp artisan vendor:publish --provider=\"Laravelcm\\Subscriptions\\SubscriptionServiceProvider\"\n```\n\nafter that please run this command\n\n```bash\nphp artisan filament-subscriptions:install\n```\n\nfinally register the plugin on `/app/Providers/Filament/AdminPanelProvider.php`\n\n```php\n-\u003eplugin(\\TomatoPHP\\FilamentSubscriptions\\FilamentSubscriptionsPlugin::make())\n```\n\n## Using \n\nnow on your User.php model or any auth model you like you need to add this trait\n\n```php\nnamespace App\\Models;\n\nuse Laravelcm\\Subscriptions\\Traits\\HasPlanSubscriptions;\nuse Illuminate\\Foundation\\Auth\\User as Authenticatable;\n\nclass User extends Authenticatable\n{\n    use HasPlanSubscriptions;\n}\n```\n\nTo configure the billing provider for your application, use the `FilamentSubscriptionsProvider`:\n\n```php\nuse TomatoPHP\\FilamentSubscriptions\\FilamentSubscriptionsProvider;\nuse TomatoPHP\\FilamentSubscriptions\\Filament\\Pages\\Billing;\nuse Filament\\Panel;\n\npublic function panel(Panel $panel): Panel\n{\n    return $panel\n        // ...\n        -\u003epages([\n            Billing::class\n        ])\n        -\u003etenantBillingProvider(new FilamentSubscriptionsProvider());\n}\n```\n\nThis setup allows users to manage their billing through a link in the tenant menu.\n\n## Requiring a Subscription\n\nTo enforce a subscription requirement for any part of your application, use the `requiresTenantSubscription()` method:\n\n```php\nuse Filament\\Panel;\n\npublic function panel(Panel $panel): Panel\n{\n    return $panel\n        // ...\n        -\u003erequiresTenantSubscription();\n}\n```\n\n\nUsers without an active subscription will be redirected to the billing page.\n\n## Register New Subscriber Type\n\nyou can register new subscriber type by using this code\n\n```php\nuse TomatoPHP\\FilamentSubscriptions\\Facades\\FilamentSubscriptions;\n\npublic function boot()\n{\n    FilamentSubscriptions::register(\n        \\TomatoPHP\\FilamentSubscriptions\\Services\\Contracts\\Subscriber::make()\n            -\u003ename('User')\n            -\u003emodel(\\App\\Models\\User::class)\n    );\n}\n```\n\n## Use Events\n\nwe add events everywhere on the subscription process and here is the list of events\n\n- `TomatoPHP\\FilamentSubscriptions\\Events\\CancelPlan`\n- `TomatoPHP\\FilamentSubscriptions\\Events\\ChangePlan`\n- `TomatoPHP\\FilamentSubscriptions\\Events\\RequestPlan`\n- `TomatoPHP\\FilamentSubscriptions\\Events\\SubscribePlan`\n\nall events have the same payload\n\n```php\nreturn [\n    \"old\" =\u003e //Plan,\n    \"new\" =\u003e //Plan,\n    \"subscription\" =\u003e //Subscription,\n]\n```\n\n## Use Facade Hook\n\nyou can use the facade hook to add your custom logic to the subscription process\n\n```php\n\nuse TomatoPHP\\FilamentSubscriptions\\Facades\\FilamentSubscriptions;\n\nFilamentSubscriptions::afterSubscription(function (array $data){\n    // your logic here\n});\n\nFilamentSubscriptions::afterRenew(function (array $data){\n    // your logic here\n});\n\nFilamentSubscriptions::afterChange(function (array $data){\n    // your logic here\n});\n\nFilamentSubscriptions::afterCanceling(function (array $data){\n    // your logic here\n});\n\n```\n## Publish Assets\n\nyou can publish config file by use this command\n\n```bash\nphp artisan vendor:publish --tag=\"filament-subscriptions-config\"\n```\n\nyou can publish views file by use this command\n\n```bash\nphp artisan vendor:publish --tag=\"filament-subscriptions-views\"\n```\n\nyou can publish languages file by use this command\n\n```bash\nphp artisan vendor:publish --tag=\"filament-subscriptions-lang\"\n```\n\n\n## Other Filament Packages\n\nCheckout our [Awesome TomatoPHP](https://github.com/tomatophp/awesome)\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomatophp%2Ffilament-subscriptions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomatophp%2Ffilament-subscriptions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomatophp%2Ffilament-subscriptions/lists"}