Subscriptionify: Laravel Subscription &amp; Feature Management | Mohamed Said        [  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png)   Mohamed Said Laravel Backend Engineer  ](https://www.msaied.com) [ Home ](https://www.msaied.com) [ Projects ](https://www.msaied.com/projects) [ Articles  ](https://www.msaied.com/articles) [ Certificates ](https://www.msaied.com/certificates) [ Contact ](https://www.msaied.com#contact-section) 

       [  ](https://github.com/EG-Mohamed)       

 [ Home ](https://www.msaied.com) [ Projects ](https://www.msaied.com/projects) [ Articles ](https://www.msaied.com/articles) [ Certificates ](https://www.msaied.com/certificates) [ Contact ](https://www.msaied.com#contact-section) 

  [ home ](https://www.msaied.com)    [ articles ](https://www.msaied.com/articles)    Subscriptionify: Feature-Based Subscription Management for Laravel        On this page       1. [  What Is Subscriptionify? ](#what-is-subscriptionify)
2. [  Installation ](#installation)
3. [  Making Any Model Subscribable ](#making-any-model-subscribable)
4. [  Four Feature Types for Different Quota Patterns ](#four-feature-types-for-different-quota-patterns)
5. [  Usage Tracking on the Subscribable Model ](#usage-tracking-on-the-subscribable-model)
6. [  Direct Grants Independent of the Plan ](#direct-grants-independent-of-the-plan)
7. [  Optional Overage and Metered Billing ](#optional-overage-and-metered-billing)
8. [  Route Middleware and Blade Directives ](#route-middleware-and-blade-directives)
9. [  Lifecycle, Events, and Scheduled Expiry ](#lifecycle-events-and-scheduled-expiry)
10. [  Key Takeaways ](#key-takeaways)

  ![Subscriptionify: Feature-Based Subscription Management for Laravel](https://cdn.msaied.com/192/63268fabe13c0569d3c83b7d81cd6ac0.png)

 [  Laravel ](https://www.msaied.com/articles?category=laravel) [  Composer Pacakge ](https://www.msaied.com/articles?category=composer-pacakge)  #Laravel   #Subscriptions   #Package   #SaaS   #Feature Flags  

 Subscriptionify: Feature-Based Subscription Management for Laravel 
====================================================================

     15 Jun 2026      4 min read    ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said  

       Table of contents

  10 sections  

1. [  01   What Is Subscriptionify?  ](#what-is-subscriptionify)
2. [  02   Installation  ](#installation)
3. [  03   Making Any Model Subscribable  ](#making-any-model-subscribable)
4. [  04   Four Feature Types for Different Quota Patterns  ](#four-feature-types-for-different-quota-patterns)
5. [  05   Usage Tracking on the Subscribable Model  ](#usage-tracking-on-the-subscribable-model)
6. [  06   Direct Grants Independent of the Plan  ](#direct-grants-independent-of-the-plan)
7. [  07   Optional Overage and Metered Billing  ](#optional-overage-and-metered-billing)
8. [  08   Route Middleware and Blade Directives  ](#route-middleware-and-blade-directives)
9. [  09   Lifecycle, Events, and Scheduled Expiry  ](#lifecycle-events-and-scheduled-expiry)
10. [  10   Key Takeaways  ](#key-takeaways)

       What Is Subscriptionify?
------------------------

[Subscriptionify](https://github.com/revoltify/subscriptionify) is a Laravel package by Rasel Islam Rafi that handles subscription plan modelling, feature quota enforcement, and usage tracking entirely within your own database. Unlike Laravel Cashier, it is completely payment-gateway-agnostic — it does not wrap any billing API. That makes it a practical choice when you bill through a provider Cashier does not support, charge against a prepaid balance, or need to gate features without charging at all.

It requires **PHP 8.2** and supports **Laravel 11, 12, and 13**.

Installation
------------

```bash
composer require revoltify/subscriptionify
php artisan vendor:publish --tag=subscriptionify-config
php artisan vendor:publish --tag=subscriptionify-migrations
php artisan migrate

```

The migrations create six tables covering plans, features, the plan/feature pivot, subscriptions, usage records, and direct feature grants.

Making Any Model Subscribable
-----------------------------

Implement the `Subscribable` contract and add the `InteractsWithSubscriptions` trait to any Eloquent model — `User`, `Organisation`, `Workspace`, or whatever fits your domain:

```php
use Revoltify\Subscriptionify\Concerns\InteractsWithSubscriptions;
use Revoltify\Subscriptionify\Contracts\Subscribable;

class Workspace extends Model implements Subscribable
{
    use InteractsWithSubscriptions;
}

```

Four Feature Types for Different Quota Patterns
-----------------------------------------------

Subscriptionify distinguishes four feature types, each with its own consumption semantics:

- **Toggle** — a plain on/off capability gate.
- **Consumable** — a depletable quota that resets on a schedule (e.g. monthly API calls).
- **Limit** — a hard cap on a running total that can be freed again (e.g. active seats or projects).
- **Metered** — pay-per-use tracking with no cap, charging per unit.

Features are created once and attached to plans through a pivot that carries the allocation:

```php
$plan->features()->attach($reports, [
    'value'          => 500,          // 0 means unlimited
    'unit_price'     => '0.02000000',
    'reset_period'   => 1,
    'reset_interval' => 'month',
]);

```

Usage Tracking on the Subscribable Model
----------------------------------------

All consumption methods live directly on the subscribable model:

```php
$workspace->subscribe($plan);
$workspace->hasFeature('reports');       // feature available?
$workspace->canConsume('reports', 10);   // 10 units available?
$workspace->consume('reports', 10);      // record usage, throws on quota breach
$workspace->tryConsume('reports', 10);   // returns false instead of throwing
$workspace->remainingUsage('reports');   // units left this period

```

For `Limit` features, `release()` hands units back — essential for slot-based resources like projects or seats:

```php
$workspace->consume('projects', 1);  // create a project
$workspace->release('projects', 1);  // delete it, freeing the slot

```

Direct Grants Independent of the Plan
-------------------------------------

`grantFeature()` assigns quota directly to a subscribable on top of whatever the plan already provides. A plan with 500 reports plus a 1,000-unit grant yields 1,500 available units — useful for one-off top-ups or promotional bonuses without creating bespoke plans:

```php
$workspace->grantFeature('reports', value: 1_000);
$workspace->revokeFeature('reports'); // plan allocation still applies

```

Optional Overage and Metered Billing
------------------------------------

Billing is opt-in. Implement the `HasFunds` contract and the package charges overage against a balance you control. Amounts are passed as strings and compared with `bccomp`, so all arithmetic is arbitrary-precision rather than floating-point. Without `HasFunds`, features fall back to hard limits that throw on breach — meaning you can enforce quotas first and add billing later without rewriting consumption code.

Route Middleware and Blade Directives
-------------------------------------

Three middleware aliases protect routes and return `403` on failure:

```php
Route::middleware('subscribed')->group(...);
Route::middleware('plan:pro')->group(...);
Route::middleware('feature:reports')->group(...);

```

Matching Blade directives gate view content, including `@onTrial` and `@feature` blocks.

Lifecycle, Events, and Scheduled Expiry
---------------------------------------

Subscriptions support `changePlan()`, `renew()`, `cancel()`, `cancelNow()`, and `resume()`. Each transition dispatches an event (`SubscriptionCreated`, `SubscriptionCancelled`, `FeatureConsumed`, etc.). An Artisan command handles expiry:

```php
Schedule::command('subscriptionify:expire-overdue')->hourly();

```

Key Takeaways
-------------

- Gateway-agnostic: works with any payment provider or no provider at all.
- Four distinct feature types cover toggle, consumable, limit, and metered patterns.
- Direct grants let you top up individual subscribers without creating new plans.
- Billing via `HasFunds` is opt-in; quota enforcement works without it.
- Arbitrary-precision math (`bcmath`) prevents floating-point billing errors.
- Middleware and Blade directives provide first-class access gating.

---

*Source: [Laravel News — Subscriptionify: Feature-Based Subscription Management for Laravel](https://laravel-news.com/subscriptionify)*

 Found this useful?

          [  ](https://twitter.com/intent/tweet?url=https%3A%2F%2Fwww.msaied.com%2Farticles%2Fsubscriptionify-feature-based-subscription-management-for-laravel&text=Subscriptionify%3A+Feature-Based+Subscription+Management+for+Laravel) [  ](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fwww.msaied.com%2Farticles%2Fsubscriptionify-feature-based-subscription-management-for-laravel) 

 Frequently Asked Questions 
----------------------------

  3 questions  

     Q01  How is Subscriptionify different from Laravel Cashier?        Laravel Cashier wraps a specific payment provider's billing API (such as Stripe or Paddle). Subscriptionify is gateway-agnostic — it tracks plans, feature quotas, and usage in your own database and does not integrate with any payment provider directly, leaving billing to you. 

      Q02  Can I enforce feature quotas without setting up billing?        Yes. Billing via the HasFunds contract is entirely opt-in. Without it, Subscriptionify enforces hard quota limits that throw an exception when exceeded. You can add billing later without rewriting any of your consumption code. 

      Q03  What is the difference between a Consumable and a Limit feature type?        A Consumable is a depletable quota that resets on a schedule, such as a monthly allowance of API calls. A Limit is a hard cap on a running total that can be freed again — for example, active project slots where deleting a project calls release() to free the slot for reuse. 

  Continue reading

 More Articles 
---------------

 [ View all    ](https://www.msaied.com/articles) 

 [ ![Laravel Telescope Alternatives: Building a Lightweight Request Inspector with Middleware](https://cdn.msaied.com/216/9b6d240010b80483f072902dafcd216c.png) laravel middleware debugging 

### Laravel Telescope Alternatives: Building a Lightweight Request Inspector with Middleware

Telescope is powerful but heavy for production. Learn how to build a focused, low-overhead request inspector u...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 16 Jun 2026     1 min read  

  Read    

 ](https://www.msaied.com/articles/laravel-telescope-alternatives-building-a-lightweight-request-inspector-with-middleware) [ ![RAG Pipelines in Laravel: Chunking, Embedding, and Retrieval with pgvector](https://cdn.msaied.com/215/e037e13535aa77822f879ee829ec3f68.png) laravel ai pgvector 

### RAG Pipelines in Laravel: Chunking, Embedding, and Retrieval with pgvector

Build a production-ready Retrieval-Augmented Generation pipeline in Laravel using pgvector, OpenAI embeddings,...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 16 Jun 2026     3 min read  

  Read    

 ](https://www.msaied.com/articles/rag-pipelines-in-laravel-chunking-embedding-and-retrieval-with-pgvector) [ ![Laravel Pest: Architecture Tests, Mutation Testing, and Type Coverage in CI](https://cdn.msaied.com/214/0d4822fa8ee1765d0689e387dd849d92.png) laravel pest testing 

### Laravel Pest: Architecture Tests, Mutation Testing, and Type Coverage in CI

Go beyond feature tests. Learn how to enforce architectural rules, catch logic gaps with mutation testing, and...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 16 Jun 2026     4 min read  

  Read    

 ](https://www.msaied.com/articles/laravel-pest-architecture-tests-mutation-testing-and-type-coverage-in-ci) 

   [  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png)   Mohamed Said Laravel Backend Engineer  ](https://www.msaied.com)Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

Explore

- [Home](https://www.msaied.com)
- [Projects](https://www.msaied.com/projects)
- [Articles](https://www.msaied.com/articles)
- [Certificates](https://www.msaied.com/certificates)
- [Contact](https://www.msaied.com#contact-section)

Connect

- [   hello@msaied.com ](mailto:hello@msaied.com)
- [   +20 109 461 9204 ](tel:+201094619204)

© 2026 Mohamed Said. All rights reserved.

 [  ](https://github.com/EG-Mohamed) [  ](https://www.linkedin.com/in/msaiedm/) [  ](https://wa.me/201094619204) [  ](mailto:hello@msaied.com) [  ](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)
