PHPackages                             rockbuzz/lara-pricing - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. rockbuzz/lara-pricing

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

rockbuzz/lara-pricing
=====================

Pricing management

0.0.10(4y ago)1220[2 PRs](https://github.com/rockbuzz/lara-pricing/pulls)MITPHPPHP &gt;=7.3

Since Mar 31Pushed 3y ago1 watchersCompare

[ Source](https://github.com/rockbuzz/lara-pricing)[ Packagist](https://packagist.org/packages/rockbuzz/lara-pricing)[ RSS](/packages/rockbuzz-lara-pricing/feed)WikiDiscussions main Synced 3d ago

READMEChangelogDependencies (5)Versions (13)Used By (0)

Lara Pricing
============

[](#lara-pricing)

Laravel package to manage plan subscriptions with restrictive and limited functionalities.

[![](https://github.com/rockbuzz/lara-pricing/workflows/Main/badge.svg)](https://github.com/rockbuzz/lara-pricing/workflows/Main/badge.svg)

Requirements
------------

[](#requirements)

PHP &gt;=7.3

Install
-------

[](#install)

```
$ composer require rockbuzz/lara-pricing
```

```
$ php artisan vendor:publish --provider="Rockbuzz\LaraPricing\ServiceProvider" --tag="migrations"
```

```
$ php artisan migrate
```

Add the `Subscribeable` interface and trait to the template you will have plan susbcriptions.

```
use Rockbuzz\LaraPricing\Traits\Subscribable;
use Rockbuzz\LaraPricing\Contracts\Subscribable as SubscribableContract;

class Account extends Model implements SubscribableContract
{
    use Subscribable;
}
```

Usage
-----

[](#usage)

### You can subscribe to a plan.

[](#you-can-subscribe-to-a-plan)

```
use Tests\Models\Account;
use Rockbuzz\LaraPricing\Models\Plan;

$plan = Plan::create([
    'name' => 'Plan Name',
    'price' => 2990,// in cents
    'interval' => 'month',
    'period' => 1
]);

$account = Account::create();
$account->subscribe($plan);
```

> when subscribing the event Rockbuzz\\LaraPricing\\Events\\SubscriptionCreated is dispatched

### You can unsubscribe the current subscription.

[](#you-can-unsubscribe-the-current-subscription)

```
use Tests\Models\Account;
use Rockbuzz\LaraPricing\Models\Plan;

$plan = Plan::create([
    'name' => 'Plan Name',
    'price' => 2990,// in cents
    'interval' => 'month',
    'period' => 1
]);

$account = Account::create();
$account->subscribe($plan);

$account->unsubscribe();
```

> when unsubscribing the event Rockbuzz\\LaraPricing\\Events\\SubscriptionCanceled is dispatched

### You can take the current subscription.

[](#you-can-take-the-current-subscription)

```
use Tests\Models\Account;
use Rockbuzz\LaraPricing\Models\Plan;

$plan = Plan::create([
    'name' => 'Plan Name',
    'price' => 2990,// in cents
    'interval' => 'month',
    'period' => 1
]);

$account = Account::create();
$account->subscribe($plan);

dd($account->currentSubscription()->toArray());

# output
[
    "id" => 1
    "uuid" => "66d0ef96-961d-4b55-8328-115ec44e05f2"
    "start_at" => "2022-12-11T14:39:55.000000Z"
    "finish_at" => null
    "canceled_at" => null
    "due_day" => null
    "subscribable_id" => "1"
    "subscribable_type" => "Tests\Models\Account"
    "plan_id" => "1"
    "immutable_plan" => array:10 [
      "name" => "Plan A"
      "price" => 2990
      "interval" => "month"
      "period" => 1
      "uuid" => "6e9a7100-c314-4653-a40f-24ec22aaaa84"
      "slug" => "plan-a"
      "updated_at" => "2022-12-11T14:39:55.000000Z"
      "created_at" => "2022-12-11T14:39:55.000000Z"
      "id" => 1
      "features" => []
    ]
    "created_at" => "2022-12-11T14:39:55.000000Z"
    "updated_at" => "2022-12-11T14:39:55.000000Z"
    "deleted_at" => null
]
```

### You can subscribe to a plan with feature restriction.

[](#you-can-subscribe-to-a-plan-with-feature-restriction)

```
use Tests\Models\Account;
use Rockbuzz\LaraPricing\Models\Plan;
use Rockbuzz\LaraPricing\Enums\PlanFeatureValue;

$feature = Feature::create(['name' => 'Feature Name']);
$plan = Plan::create([
    'name' => 'Plan B',
    'price' => 2990,// in cents
    'interval' => 'month',
    'period' => 1
]);
$plan->features()->attach([
    $feature->id => ['value' => PlanFeatureValue::POSITIVE]
]);// Y, OK and TRUE values are accepted

$account = Account::create();
$account->subscribe($plan);

dd($account->currentSubscription()->toArray());

#output
[
  "id" => 1
  "uuid" => "be571da1-f145-4acf-9494-ebcbc84b0a8f"
  "start_at" => "2022-12-11T15:00:54.000000Z"
  "finish_at" => null
  "canceled_at" => null
  "due_day" => null
  "subscribable_id" => "1"
  "subscribable_type" => "Tests\Models\Account"
  "plan_id" => "1"
  "immutable_plan" => array:10 [
    "name" => "Plan B"
    "price" => 2990
    "interval" => "month"
    "period" => 1
    "uuid" => "c703d2fd-76b5-461f-92f2-05b3a2a4e3ab"
    "slug" => "plan-b"
    "updated_at" => "2022-12-11T15:00:54.000000Z"
    "created_at" => "2022-12-11T15:00:54.000000Z"
    "id" => 1
    "features" => array:1 [
      0 => array:9 [
        "id" => 1
        "uuid" => "b1adf248-ae4b-464d-9667-462e51de6d2f"
        "name" => "aut"
        "slug" => "aut"
        "order_column" => "1"
        "created_at" => "2022-12-11T15:00:54.000000Z"
        "updated_at" => "2022-12-11T15:00:54.000000Z"
        "deleted_at" => null
        "pivot" => array:3 [
          "plan_id" => "1"
          "feature_id" => "1"
          "value" => "Y"
        ]
      ]
    ]
  ]
  "created_at" => "2022-12-11T15:00:54.000000Z"
  "updated_at" => "2022-12-11T15:00:54.000000Z"
  "deleted_at" => null
]
```

### You can check if a feature is available in the current subscription.

[](#you-can-check-if-a-feature-is-available-in-the-current-subscription)

```
use Tests\Models\Account;
use Rockbuzz\LaraPricing\Models\Plan;

$feature = Feature::create(['name' => 'Feature Name']);
$plan = Plan::create([
    'name' => 'Plan Name',
    'price' => 2990,// in cents
    'interval' => 'month',
    'period' => 1
]);
$plan->features()->attach([$feature->id => ['value' => PlanFeatureValue::POSITIVE]]);

$account = Account::create();
$account->subscribe($plan);

dd($account->featureEnabled($feature->slug));

#output

true
```

### You can subscribe to a plan with feature limit.

[](#you-can-subscribe-to-a-plan-with-feature-limit)

```
use Tests\Models\Account;
use Rockbuzz\LaraPricing\Models\Plan;

$feature = Feature::create(['name' => 'Feature Name']);
$plan = Plan::create([
    'name' => 'Plan Name',
    'price' => 2990,// in cents
    'interval' => 'month',
    'period' => 1
]);
$plan->features()->attach([$feature->id => ['value' => '10']]);

$account = Account::create();
$account->subscribe($plan);

dd($account->currentSubscription()->toArray());

#output
[
  "id" => 1
  "uuid" => "e39d1ce4-08c7-422a-b940-b7575aa613e2"
  "start_at" => "2022-12-11T15:08:38.000000Z"
  "finish_at" => null
  "canceled_at" => null
  "due_day" => null
  "subscribable_id" => "1"
  "subscribable_type" => "Tests\Models\Account"
  "plan_id" => "1"
  "immutable_plan" => array:10 [
    "name" => "Plan B"
    "price" => 2990
    "interval" => "month"
    "period" => 1
    "uuid" => "14fdab88-a6d5-4d4d-b2c8-ccb3786778e6"
    "slug" => "plan-b"
    "updated_at" => "2022-12-11T15:08:38.000000Z"
    "created_at" => "2022-12-11T15:08:38.000000Z"
    "id" => 1
    "features" => array:1 [
      0 => array:9 [
        "id" => 1
        "uuid" => "f0935f56-2dd8-49bc-b2e2-52bc5dcf15f0"
        "name" => "eos"
        "slug" => "eos"
        "order_column" => "1"
        "created_at" => "2022-12-11T15:08:38.000000Z"
        "updated_at" => "2022-12-11T15:08:38.000000Z"
        "deleted_at" => null
        "pivot" => array:3 [
          "plan_id" => "1"
          "feature_id" => "1"
          "value" => "10"
        ]
      ]
    ]
  ]
  "created_at" => "2022-12-11T15:08:38.000000Z"
  "updated_at" => "2022-12-11T15:08:38.000000Z"
  "deleted_at" => null
]
```

### You can get the usage amount of a feature in the current subscription.

[](#you-can-get-the-usage-amount-of-a-feature-in-the-current-subscription)

```
use Tests\Models\Account;
use Rockbuzz\LaraPricing\Models\Plan;

$feature = Feature::create(['name' => 'Feature Name']);
$plan = Plan::create([
    'name' => 'Plan Name',
    'price' => 2990,// in cents
    'interval' => 'month',
    'period' => 1
]);
$plan->features()->attach([$feature->id => ['value' => '10']]);

$account = Account::create();
$account->subscribe($plan);

dd($account->featureEnabled($feature->slug));

#output

10
```

### You can check the usage amount of a feature in the current subscription.

[](#you-can-check-the-usage-amount-of-a-feature-in-the-current-subscription)

```
use Tests\Models\Account;
use Rockbuzz\LaraPricing\Models\Plan;

$feature = Feature::create(['name' => 'Feature Name']);
$plan = Plan::create([
    'name' => 'Plan Name',
    'price' => 2990,// in cents
    'interval' => 'month',
    'period' => 1
]);
$plan->features()->attach([$feature->id => ['value' => '10']]);

$account = Account::create();
$account->subscribe($plan);

dd($account->consumedUse($feature->slug));

#output

0
```

### You can check the rest of usage of a feature of the current subscription.

[](#you-can-check-the-rest-of-usage-of-a-feature-of-the-current-subscription)

```
use Tests\Models\Account;
use Rockbuzz\LaraPricing\Models\Plan;

$feature = Feature::create(['name' => 'Feature Name']);
$plan = Plan::create([
    'name' => 'Plan Name',
    'price' => 2990,// in cents
    'interval' => 'month',
    'period' => 1
]);
$plan->features()->attach([$feature->id => ['value' => '10']]);

$account = Account::create();
$account->subscribe($plan);

dd($account->remainingUse($feature->slug));

#output

10
```

### You can increment the usage of a functionality in the current subscription.

[](#you-can-increment-the-usage-of-a-functionality-in-the-current-subscription)

```
use Tests\Models\Account;
use Rockbuzz\LaraPricing\Models\Plan;

$feature = Feature::create(['name' => 'Feature Name']);
$plan = Plan::create([
    'name' => 'Plan Name',
    'price' => 2990,// in cents
    'interval' => 'month',
    'period' => 1
]);
$plan->features()->attach([$feature->id => ['value' => '10']]);

$account = Account::create();
$account->subscribe($plan);

$account->incrementUse($feature->slug);
```

> Optionally you can pass a second parameter with integer value to increment, default is 1.
> $account-&gt;incrementUse($feature-&gt;slug, 2);

### You can decrement the usage of a functionality in the current subscription.

[](#you-can-decrement-the-usage-of-a-functionality-in-the-current-subscription)

```
use Tests\Models\Account;
use Rockbuzz\LaraPricing\Models\Plan;

$feature = Feature::create(['name' => 'Feature Name']);
$plan = Plan::create([
    'name' => 'Plan Name',
    'price' => 2990,// in cents
    'interval' => 'month',
    'period' => 1
]);
$plan->features()->attach([$feature->id => ['value' => '10']]);

$account = Account::create();
$account->subscribe($plan);

$account->decrementUse($feature->slug);
```

> Optionally you can pass a second parameter with integer value to decrement, default is 1.
> $account-&gt;decrementUse($feature-&gt;slug, 2);

### You can check if you can use a feature of the current subscription.

[](#you-can-check-if-you-can-use-a-feature-of-the-current-subscription)

```
use Tests\Models\Account;
use Rockbuzz\LaraPricing\Models\Plan;

$feature = Feature::create(['name' => 'Feature Name']);
$plan = Plan::create([
    'name' => 'Plan Name',
    'price' => 2990,// in cents
    'interval' => 'month',
    'period' => 1
]);
$plan->features()->attach([$feature->id => ['value' => '10']]);

$account = Account::create();
$account->subscribe($plan);

dd($account->canUse($feature->slug));

#output

true
```

### You can clear the usages of a functionality from the current subscription.

[](#you-can-clear-the-usages-of-a-functionality-from-the-current-subscription)

```
use Tests\Models\Account;
use Rockbuzz\LaraPricing\Models\Plan;

$feature = Feature::create(['name' => 'Feature Name']);
$plan = Plan::create([
    'name' => 'Plan Name',
    'price' => 2990,// in cents
    'interval' => 'month',
    'period' => 1
]);
$plan->features()->attach([$feature->id => ['value' => '10']]);

$account = Account::create();
$account->subscribe($plan);

$account->cleanUse($feature->slug);
```

### You can manage recurrences of the current subscription.

[](#you-can-manage-recurrences-of-the-current-subscription)

```
use Tests\Models\Account;
use Rockbuzz\LaraPricing\Models\Plan;

$plan = Plan::create([
    'name' => 'Plan Name',
    'price' => 2990,// in cents
    'interval' => 'month',
    'period' => 1
]);

$account = Account::create();

# by default when signing the recurrence is on
$account->subscribe($plan);

dump($account->isRecurrent());

# output

true

$account->cancelRecurrence();

dd($account->isRecurrent());

# output

false
```

> When canceling a recurrence event Rockbuzz\\LaraPricing\\Events\\SubscriptionCancelRecurrence is dispatched.

License
-------

[](#license)

The Lara Pricing is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 70.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~56 days

Recently: every ~123 days

Total

10

Last Release

1729d ago

PHP version history (2 changes)0.0.1PHP ^7.3

0.0.9PHP &gt;=7.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/9a5c02aa268a45e5f1d9c67c331503d326eb4b49eb0fb80293dc7379ccef51f7?d=identicon)[rockbuzz](/maintainers/rockbuzz)

---

Top Contributors

[![tiagodevweb](https://avatars.githubusercontent.com/u/15040375?v=4)](https://github.com/tiagodevweb "tiagodevweb (31 commits)")[![rockbuzz-dev](https://avatars.githubusercontent.com/u/48301419?v=4)](https://github.com/rockbuzz-dev "rockbuzz-dev (11 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

---

Tags

subscriptionsfeaturespricingplans

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/rockbuzz-lara-pricing/health.svg)

```
[![Health](https://phpackages.com/badges/rockbuzz-lara-pricing/health.svg)](https://phpackages.com/packages/rockbuzz-lara-pricing)
```

###  Alternatives

[gerardojbaez/laraplans

SaaS style recurring plans for Laravel.

17817.5k1](/packages/gerardojbaez-laraplans)[andychukse/laravel-pricing-plans

A package provide pricing plans for Laravel.

121.8k](/packages/andychukse-laravel-pricing-plans)[serendipity_hq/bundle-features

Manage features and plans in your Symfony app.

1184.3k](/packages/serendipity-hq-bundle-features)[yannickl88/features-bundle

Symfony bundle for managing feature tags

1985.5k](/packages/yannickl88-features-bundle)[seanstewart/plan-config

Plan config allows you to easily define attributes and limits for your SaaS application subscription plans.

314.0k](/packages/seanstewart-plan-config)[opengento/module-saleable

This extension allows to set if a product is saleable and can show its price by scope and customer group.

136.9k](/packages/opengento-module-saleable)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
