Tashil: Laravel Subscription Plans &amp; Feature Limits | Mohamed Said       [Skip to content](#main)  [ ![](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png) Mohamed SaidLaravel Backend Engineer ](https://www.msaied.com/public) - [Home](https://www.msaied.com/public)
- [Projects](https://www.msaied.com/public/projects)
- [Articles](https://www.msaied.com/public/articles)
- [Certificates](https://www.msaied.com/public/certificates)
- [About](https://www.msaied.com/public#about)

           [  Contact](https://www.msaied.com/public#contact) Menu 

Menu
----

Close 

 - [HomeStart here](https://www.msaied.com/public)
- [ProjectsCase studies](https://www.msaied.com/public/projects)
- [ArticlesEngineering notes](https://www.msaied.com/public/articles)
- [CertificatesCredentials](https://www.msaied.com/public/certificates)
- [AboutHow I work](https://www.msaied.com/public#about)
- [ContactGet in touch](https://www.msaied.com/public#contact)

  [Start a conversation](https://www.msaied.com/public#contact) [WhatsApp](https://wa.me/201094619204) [Email](mailto:hello@msaied.com) 

 1. [Home](https://www.msaied.com/public)
2. /
3. [Articles](https://www.msaied.com/public/articles)
4. /
5. [Laravel](https://www.msaied.com/public/articles?category=laravel)
6. /
7. Tashil: Add Subscription Plans and Feature Usage Limits to Laravel

   [Laravel](https://www.msaied.com/public/articles?category=laravel) [Composer Pacakge](https://www.msaied.com/public/articles?category=composer-pacakge) 

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

 Tashil is a Laravel package that stores subscription plans in your database, tracks per-feature usage limits, fires warning events, and generates MRR and churn reports — without handling payments itself.

 ![](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp) [Mohamed Said](https://www.msaied.com/public#person) Published 28 Sep 2026 · Updated 28 Sep 2026 · 4 min read

ShareCopy linkCopied

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

  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)

 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)*

- [Laravel](https://www.msaied.com/public/articles?search=Laravel)
- [Subscriptions](https://www.msaied.com/public/articles?search=Subscriptions)
- [SaaS](https://www.msaied.com/public/articles?search=SaaS)
- [Composer Package](https://www.msaied.com/public/articles?search=Composer%20Package)
- [Feature Flags](https://www.msaied.com/public/articles?search=Feature%20Flags)
- [Usage Limits](https://www.msaied.com/public/articles?search=Usage%20Limits)

 Frequently asked questions 
---------------------------

  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.

   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()`.

   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.

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

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

[About](https://www.msaied.com/public#about) [GitHub ↗](https://github.com/EG-Mohamed) [LinkedIn ↗](https://www.linkedin.com/in/msaiedm/) [WhatsApp ↗](https://wa.me/201094619204) [Email Address ↗](mailto:hello@msaied.com) [My CV ↗](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)  

   [Previous articleLaravel API Resources: Sparse Fieldsets, Conditional Relationships, and Cursor Pagination](https://www.msaied.com/public/articles/laravel-api-resources-sparse-fieldsets-conditional-relationships-and-cursor-pagination) [Next articleFilament v5 Preview: What Is Changing and How to Prepare Your Codebase](https://www.msaied.com/public/articles/filament-v5-preview-what-is-changing-and-how-to-prepare-your-codebase-1)  

   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)

 ###  Have a technical challenge?

 Tell me what you’re building. I reply within two working days.

[Start a conversation](https://www.msaied.com/public#contact) 

   Related articles
-----------------

 [ ![](https://cdn.msaied.com/740/cce86edc21eddcbdd2f2454fadaf9c70.png)  · 3 min read### The Pipeline Pattern in Laravel: Custom Pipelines Beyond Middleware

5 Oct 2026 ](https://www.msaied.com/public/articles/the-pipeline-pattern-in-laravel-custom-pipelines-beyond-middleware-1) [ ![](https://cdn.msaied.com/739/2d6897fdcdcf090613f96f72a64b8a78.png)  · 4 min read### MySQL Full-Text Search in Laravel: Indexes, Relevance Scoring, and Boolean Mode

4 Oct 2026 ](https://www.msaied.com/public/articles/mysql-full-text-search-in-laravel-indexes-relevance-scoring-and-boolean-mode) [ ![](https://cdn.msaied.com/738/073696a3fefe18bec825beec5ac658f5.png)  · 4 min read### Laravel Queue Rate-Limited Middleware: Throttling Jobs Without Losing Work

4 Oct 2026 ](https://www.msaied.com/public/articles/laravel-queue-rate-limited-middleware-throttling-jobs-without-losing-work) 

  Have a technical challenge?
----------------------------

Tell me what you’re building. I reply within two working days.

 [Discuss your project ↗](https://www.msaied.com/public#contact) 

  © 2026 Mohamed Said · Built with Laravel, meant to last.Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

 - [Home](https://www.msaied.com/public)
- [Articles](https://www.msaied.com/public/articles)
- [Certificates](https://www.msaied.com/public/certificates)
- [GitHub](https://github.com/EG-Mohamed)
- [LinkedIn](https://www.linkedin.com/in/msaiedm/)
- [WhatsApp](https://wa.me/201094619204)
- [Email Address](mailto:hello@msaied.com)
- [My CV](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)
- [Sitemap](https://www.msaied.com/public/sitemap.xml)
