zainmalik / billforge
SaaS Subscription management package with multiple gateways, dynamic route blocking, and admin dashboard.
Requires
- php: ^8.1
- illuminate/support: ^10.0|^11.0|^12.0
README
A powerful, full-featured SaaS subscription management package for Laravel. It provides dynamic route protection, multiple gateway support, and a beautiful Admin Dashboard.
Features
- Admin Dashboard: A modern TailwindCSS control panel for your subscriptions.
- Multiple Gateways: Built-in support for Stripe, PayPal, and Authorize.net. Add credentials directly from the UI.
- Subscription Tiers: Create unlimited subscription packages, link them to gateway plans (e.g., Stripe Price IDs).
- Dynamic Route Blocking: Secure your app's routes. Assign access permissions via the admin dashboard, and use the included middleware to protect your SaaS features dynamically.
Installation
- Require the package locally (if developing) or via composer:
composer require zainmalik/billForge
- Publish the package assets and configuration:
php artisan vendor:publish --provider="Zain\BillForge\BillForgeServiceProvider"
- Run migrations:
php artisan migrate
Setup & Usage
1. Protect Routes
Add the middleware subscription.access to any routes you'd like to protect dynamically from the admin panel:
Route::get('/saas/premium-feature', [PremiumController::class, 'index']) ->middleware(['auth', 'subscription.access']) ->name('saas.feature');
Note: Users without an active subscription mapped to this route will be blocked.
2. Update User Model
Add the HasSubscriptions trait to your host application's User model (App\Models\User):
namespace App\Models; use Illuminate\Foundation\Auth\User as Authenticatable; use Zain\BillForge\Traits\HasSubscriptions; class User extends Authenticatable { use HasSubscriptions; // ... }
3. Access the Admin Dashboard
Navigate to /admin/subscriptions in your application to access the modern control panel. From there, you can configure your Payment Gateways, set up Packages, and map them to standard application Routes.