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

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

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

  [ home ](https://msaied.com)    [ articles ](https://msaied.com/articles)    Tashil: Add Subscription Plans and Feature Usage Limits to Laravel        On this page       1. [  What Is Tashil? ](#what-is-tashil)
2. [  Defining Plans and Features ](#defining-plans-and-features)
3. [  Tracking Feature Usage ](#tracking-feature-usage)
4. [  Blade Directives and Middleware ](#blade-directives-and-middleware)
5. [  Recording Payments ](#recording-payments)
6. [  Revenue Analytics ](#revenue-analytics)
7. [  Alternatives Worth Knowing ](#alternatives-worth-knowing)
8. [  Key Takeaways ](#key-takeaways)

  ![Tashil: Add Subscription Plans and Feature Usage Limits to Laravel](https://cdn.msaied.com/713/98c40d9d0472588d25d8b8359a96d1b1.png)

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

 Tashil: Add Subscription Plans and Feature Usage Limits to Laravel 
====================================================================

     28 Sep 2026      4 min read    ![Mohamed Said](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp)  Mohamed Said  

       Table of contents

1. [  01   What Is Tashil?  ](#what-is-tashil)
2. [  02   Defining Plans and Features  ](#defining-plans-and-features)
3. [  03   Tracking Feature Usage  ](#tracking-feature-usage)
4. [  04   Blade Directives and Middleware  ](#blade-directives-and-middleware)
5. [  05   Recording Payments  ](#recording-payments)
6. [  06   Revenue Analytics  ](#revenue-analytics)
7. [  07   Alternatives Worth Knowing  ](#alternatives-worth-knowing)
8. [  08   Key Takeaways  ](#key-takeaways)

 What Is Tashil?
---------------

Building a SaaS with tiered plans — think a Hobby tier with four podcast uploads per month and a Studio tier with thirty plus a custom domain — means you need two things: a place to store those plan definitions and a reliable way to count how much of each feature a subscriber has used. [Tashil](https://github.com/Foysal50x/tashil), a package by Foysal Ahmed, handles both without touching your payment gateway.

Tashil requires PHP 8.2 or later and supports Laravel 10 through 13.

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

```

Defining Plans and Features
---------------------------

Any Eloquent model can be a subscriber. Add the `Subscribable` contract and the `HasSubscriptions` trait, then define features and attach them to a plan:

```php
class Team extends Model implements Subscribable
{
    use HasSubscriptions;
}

$uploads = Tashil::feature('episode-uploads')
    ->name('Episode Uploads')
    ->limit()
    ->create();

$uploads->update(['reset_period' => ResetPeriod::Monthly]);

$customDomain = Tashil::feature('custom-domain')
    ->name('Custom Domain')
    ->boolean()
    ->create();

$hobby = Tashil::package('hobby')
    ->name('Hobby')
    ->price(12)
    ->monthly()
    ->feature($uploads, value: '4')
    ->feature($customDomain, value: 'false')
    ->create();

```

Existing subscribers keep the limits they signed up with when you change a plan later — only new subscribers receive updated values.

Tracking Feature Usage
----------------------

`useFeature()` increments the counter and returns `false` when the subscriber is already at the limit. The check and the update happen in a single database query, so two simultaneous requests cannot both slip past the ceiling:

```php
if (! $team->useFeature('episode-uploads')) {
    return back()->withErrors([
        'audio' => "You've used all {$team->featureValue('episode-uploads')} uploads this month.",
    ]);
}

```

When a subscriber reaches 80 % of a limit, Tashil fires a `UsageLimitWarning` event once per period. A listener can use that event to prompt an upgrade email.

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

Tashil ships with a `@feature` Blade directive and route middleware. If subscriptions belong to a team rather than the authenticated user, register a resolver in a service provider:

```php
Tashil::resolveSubscribableUsing(fn () => auth()->user()?->currentTeam);

```

Then gate UI sections by feature:

```blade
@feature('custom-domain')

@else
    Custom domains are available on the Studio plan.
@endfeature

```

Recording Payments
------------------

Tashil does not process payments. You charge the customer through Stripe, Paddle, or any other gateway, then record the result:

```php
$subscription = $team->subscribe($hobby);
$invoice = Tashil::billing()->pendingInvoice($subscription);
Tashil::billing()->recordPayment($invoice, gateway: 'paddle', transactionId: 'txn_01j9k2');

```

If a webhook fires twice, Tashil returns the existing record instead of creating a duplicate. Trials, upgrades, scheduled downgrades, and cancellations with a grace period are all supported:

```php
$team->switchPlan($studio);       // upgrade immediately
$team->scheduleDowngrade($hobby); // downgrade at period end
$team->cancelSubscription();      // access continues until period ends

```

Revenue Analytics
-----------------

```php
Tashil::analytics()->calculateMRR();
Tashil::analytics()->churnRate(days: 30);
Tashil::analytics()->trialConversionRate();

```

MRR includes teams still on a trial. Scheduled commands handle renewal invoices, usage resets, trial expirations, and pending downgrades automatically.

Alternatives Worth Knowing
--------------------------

- **Subscriptionify** — closest alternative; handles plans and feature limits without a gateway, but no invoices or revenue reports.
- **Laravel Cashier / Laravel Polar** — gateway-specific; plans are defined in the payment provider.
- **Laravel Pennant** — feature flags only, no plans or usage limits.

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

- Tashil stores plans and features in your own database, keeping you gateway-agnostic.
- Usage checks are atomic (single query), preventing race-condition overages.
- The `UsageLimitWarning` event fires at 80 % consumption, giving you a hook for upgrade prompts.
- Existing subscribers are shielded from plan changes; only new sign-ups see updated limits.
- Built-in analytics cover MRR, churn rate, and trial conversion rate.

---

*Source: [Tashil: Laravel Subscription Plans and Feature Usage Limits — Laravel News](https://laravel-news.com/tashil-laravel-subscriptions)*

 Found this useful?

          [  ](https://twitter.com/intent/tweet?url=https%3A%2F%2Fmsaied.com%2Farticles%2Ftashil-add-subscription-plans-and-feature-usage-limits-to-laravel&text=Tashil%3A+Add+Subscription+Plans+and+Feature+Usage+Limits+to+Laravel) [  ](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fmsaied.com%2Farticles%2Ftashil-add-subscription-plans-and-feature-usage-limits-to-laravel) 

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

  3 questions  

     Q01  Does Tashil process payments or integrate with a specific payment gateway?        No. Tashil does not handle payments. You charge customers through Stripe, Paddle, or any other gateway, then record the transaction in Tashil using `Tashil::billing()-&gt;recordPayment()`. This keeps Tashil gateway-agnostic. 

      Q02  What happens if two requests try to consume the last unit of a feature at the same time?        Tashil performs the limit check and the usage increment in a single database query, so concurrent requests cannot both exceed the limit. Only one will succeed; the other receives `false` from `useFeature()`. 

      Q03  Will existing subscribers be affected if I change the feature values on a plan?        No. Subscribers keep the limits they signed up with at the time of subscription. Only new subscribers receive the updated feature values. 

  Continue reading

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

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

 [ ![Profiling Laravel with Blackfire and Xdebug: Finding Real Bottlenecks](https://cdn.msaied.com/712/7fd2cb3e1dda6c009d734cd376d14e36.png) laravel performance blackfire 

### Profiling Laravel with Blackfire and Xdebug: Finding Real Bottlenecks

Stop guessing where your Laravel app is slow. Learn how to use Blackfire and Xdebug profiling together to pinp...

  ![Mohamed Said](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp)  Mohamed Said 

 28 Sep 2026     4 min read  

  Read    

 ](https://msaied.com/articles/profiling-laravel-with-blackfire-and-xdebug-finding-real-bottlenecks-2) [ ![Filament v5 Preview: What Is Changing and How to Prepare Your Codebase](https://cdn.msaied.com/711/0f685151a6c04b1c707230164839d12e.png) filament laravel filament-v5 

### Filament v5 Preview: What Is Changing and How to Prepare Your Codebase

Filament v5 is on the horizon with deeper PHP 8.3+ type safety, a revised plugin contract, and schema composit...

  ![Mohamed Said](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp)  Mohamed Said 

 28 Sep 2026     4 min read  

  Read    

 ](https://msaied.com/articles/filament-v5-preview-what-is-changing-and-how-to-prepare-your-codebase-1) [ ![Laravel API Resources: Sparse Fieldsets, Conditional Relationships, and Cursor Pagination](https://cdn.msaied.com/710/4f310773d50e6b3a7ab53e64d3e76921.png) laravel api eloquent 

### Laravel API Resources: Sparse Fieldsets, Conditional Relationships, and Cursor Pagination

Go beyond basic JsonResource usage. Learn how to implement sparse fieldsets, conditionally load relationships...

  ![Mohamed Said](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp)  Mohamed Said 

 27 Sep 2026     3 min read  

  Read    

 ](https://msaied.com/articles/laravel-api-resources-sparse-fieldsets-conditional-relationships-and-cursor-pagination) 

   [  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png)   Mohamed Said Laravel Backend Engineer  ](https://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://msaied.com)
- [Projects](https://msaied.com/projects)
- [Articles](https://msaied.com/articles)
- [Certificates](https://msaied.com/certificates)
- [Contact](https://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)
