{"id":22827478,"url":"https://github.com/lacodix/laravel-plans","last_synced_at":"2025-07-23T10:06:49.378Z","repository":{"id":246818013,"uuid":"822502786","full_name":"lacodix/laravel-plans","owner":"lacodix","description":"A Laravel package to manage plans, features and subscriptions and track billing in your Laravel SAAS.","archived":false,"fork":false,"pushed_at":"2024-09-27T18:44:07.000Z","size":89,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-19T07:23:31.118Z","etag":null,"topics":["features","laravel","plan","saas","subscription"],"latest_commit_sha":null,"homepage":"","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/lacodix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"lacodix"}},"created_at":"2024-07-01T09:22:15.000Z","updated_at":"2024-10-19T13:08:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"38dc05ec-62f7-4978-b1d6-3aeac0a7d802","html_url":"https://github.com/lacodix/laravel-plans","commit_stats":null,"previous_names":["lacodix/laravel-plans"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/lacodix/laravel-plans","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lacodix%2Flaravel-plans","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lacodix%2Flaravel-plans/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lacodix%2Flaravel-plans/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lacodix%2Flaravel-plans/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lacodix","download_url":"https://codeload.github.com/lacodix/laravel-plans/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lacodix%2Flaravel-plans/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266658041,"owners_count":23963620,"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","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["features","laravel","plan","saas","subscription"],"created_at":"2024-12-12T18:10:51.558Z","updated_at":"2025-07-23T10:06:49.356Z","avatar_url":"https://github.com/lacodix.png","language":"PHP","funding_links":["https://github.com/sponsors/lacodix"],"categories":[],"sub_categories":[],"readme":"# laravel-plans\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/lacodix/laravel-plans.svg?style=flat-square)](https://packagist.org/packages/lacodix/laravel-plans)\n[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/lacodix/laravel-plans/test.yaml?branch=master\u0026label=tests\u0026style=flat-square)](https://github.com/lacodix/laravel-plans/actions?query=workflow%3Atest+branch%3Amaster)\n[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/lacodix/laravel-plans/style.yaml?branch=master\u0026label=code%20style\u0026style=flat-square)](https://github.com/lacodix/laravel-plans/actions?query=workflow%3Astyle+branch%3Amaster)\n[![Total Downloads](https://img.shields.io/packagist/dt/lacodix/laravel-plans.svg?style=flat-square)](https://packagist.org/packages/lacodix/laravel-plans)\n\n## Documentation\n\nYou can find the entire documentation for this package on [our documentation site](https://www.lacodix.de/docs/laravel-plans). Including several usecases\nwith detailed explanation.\n\n## What it does\n\n- Manage all **Plans** and **Addons** of your SaaS where users can subscribe to.\n- **Subscribe** to one or more plans with different billing intervals.\n- Manage optional **features**, if you need it. You can also stick with plans and just check for a subscribed plan.\n- Offer **countable** and **uncountable** features. Use uncountable features to just enable/disable a functionality. Use \ncountable features, for things like tokens, credits, and others. Attach different values of the feature to different\nplans, including \"unlimited\". Auto reset the values after given intervals.\n- **Consume** Features as long as some amount is available. Split up usage on different plans, depending on the order of\nthe plans.\n- **Translate** your plans and features. Identify both by slug in your app, but offer it to your users localized, powered\nby [spatie/laravel-translatable](https://github.com/spatie/laravel-translatable)\n- **Order** your plans, features (for visualisation to your users) and subscriptions (to keep control over usage order)\n- Allow **meta data** in plans and subscriptions. The usage of meta data is up to you. In some usecase we take meta data\nto save currency or additional price information. This information can be used by a subsequent billing system. \n\n## What it doesn't\n\n- **Billing**. We don't create invoices or keep track on bills. Use the invoice service of your choice, doesn't matter which.\nStripe, PayPal, your own software and any other. You just get events from this package, when subscriptions are created \nor renewed, and this can be used to trigger invoices. You are also free to wait for payment before you create the \nsubscription or the other way round.\n- **Pricing**. Yes there is a price column in the plan model, that can be used for visualisation. You also can use meta data\nfor additional price information like we do it in some examples. But you don't need to use it. You can keep your prices\nin your billing system or save it separate from the plans. But indeed, if you use the price-column you can also get\ncalculated prices for partial subscription intervals.\n\n## Installation\n\n```bash\ncomposer require lacodix/laravel-plans\n```\n\n## Quickstart\n\nTo get familiar with all settings and possibilities, please see the more detailed examples. This is only\na very quick overview how the package can work.\n\n### Subscribers\n\nAdd our HasSubscription Trait to any model.\n\n```php \nuse Lacodix\\LaravelPlans\\Models\\Traits\\HasSubscriptions;\n\nclass User extends Authenticatable {\n    use HasSubscriptions;\n    \n    ...\n}\n```\n\n### Plans and Features\n\nCreate a Plan with Features (the latter is optional, if you don't need feature functionality).\n\n```php \nuse Lacodix\\LaravelPlans\\Enums\\Interval;\nuse Lacodix\\LaravelPlans\\Models\\Feature;\nuse Lacodix\\LaravelPlans\\Models\\Plan;\n\n$myPlan = Plan::create([\n    'slug' =\u003e 'my-plan',\n    'name' =\u003e 'My Plan', // can also be locale-array - see Feature below\n    'price' =\u003e 50.0,\n    'active' =\u003e true,\n    'billing_interval' =\u003e Interval::MONTH,\n    'billing_period' =\u003e 1,\n    'meta' =\u003e [\n        'price_per_token' =\u003e 0.05,\n    ],\n]);\n\n$myFeature = Feature::create([\n    'slug' =\u003e 'tokens',\n    'name' =\u003e [\n        'de' =\u003e 'Zusätzliche Tokens',\n        'en' =\u003e 'Additional Tokens',\n    ],\n]);\n\n$myPlan-\u003efeatures()-\u003eattach($myFeature, [\n    'value' =\u003e 1000,\n    'resettable_period' =\u003e 1,\n    'resettable_interval' =\u003e Interval::MONTH,\n]);\n```\n\n### Subscribe and renew\n\n```php \n// Subscribe to multiple plans\n$user-\u003esubscribe($myPlan1, 'main');\n$user-\u003esubscribe($myPlan2, 'addon');\n\n// Change Subscription\n$user-\u003esubscribe($myPlan3, 'main'); // will replace myPlan1 subscription\n\n// Renew\n$user-\u003esubscriptions()-\u003efirst()-\u003erenew();\n\n// Cancel\n$user-\u003esubscriptions()-\u003efirst()-\u003ecancel();\n```\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Contributing\n\nPlease run the following commands and solve potential problems before committing\nand think about adding tests for new functionality.\n\n```bash\ncomposer rector:test\ncomposer insights\ncomposer csfixer:test\ncomposer phpstan:test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Credits\n\n- [lacodix](https://github.com/lacodix)\n- [laravel Cameroon](https://github.com/laravelcm)\n\nThis package is inspired by [Laravel Subscriptions](https://github.com/laravelcm/laravel-subscriptions) created \nby Laravel Cameroon and was initially started as a fork of it. After several decisions to go different ways for\nsubscription calculation, it was rewritten from scratch, but still contains several simple methods and other code \nparts of the original. So if this package doesn't fit your needs, try a look into Laravel Cameroons subscription\npackage.\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flacodix%2Flaravel-plans","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flacodix%2Flaravel-plans","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flacodix%2Flaravel-plans/lists"}