| Install | |
|---|---|
composer require ntech-services/subscription-system-admin |
|
| Latest Version: | v0.0.2 |
| PHP: | ^8.1 |
Perfect for SaaS applications, membership sites, or any Laravel project that needs subscription management capabilities. The package integrates seamlessly with Filament's admin panel and provides both API and web routes for maximum flexibility.
Main dashboard showing subscription metrics and key statistics
Intuitive interface for creating and managing subscription plans
Configure plan features, limits, and pricing overrides
Detailed view of individual subscriptions with usage tracking
Create and manage discount coupons and promotional codes
If you don't have Filament installed yet, follow the documentation here: https://filamentphp.com/docs/4.x/introduction/installation#installing-the-panel-builder
You can install the package via Composer:
composer require ntech-services/subscription-system-admin
Run this command to install the subscription system tables:
php artisan migrate:subscription-system
In your AdminPanelProvider, add the plugin:
use NtechServices\SubscriptionSystemAdmin\SubscriptionSystemAdminPlugin;
public function panel(Panel $panel): Panel
{
return $panel
// ... other configuration
->plugins([
SubscriptionSystemAdminPlugin::make()
->subscriptionFeatureUsage(false) // Optional: disable feature usage
->coupons(true) // Optional: enable coupons
]);
}
You can publish and customize the configuration file:
php artisan vendor:publish --tag="subscription-system-admin-config"
After publishing the config, run the standard migrations:
php artisan migrate
You can publish the config file to customize the package behavior:
php artisan vendor:publish --tag="subscription-system-admin-config"
This is the contents of the published config file:
<?php
return [
// Enable or disable API routes
'enable_api_routes' => true,
// Enable or disable web routes
'enable_web_routes' => false,
// API routes prefix
'api_prefix' => 'api/ntech-subscription',
// Web routes prefix
'web_prefix' => 'ntech-subscription',
// Middleware for API routes
'api_middleware' => ['api'],
// Middleware for web routes
'web_middleware' => ['web', 'auth'],
];
You can publish and customize the views:
php artisan vendor:publish --tag="subscription-system-admin-views"
You can publish the migration files to customize them:
php artisan vendor:publish --tag="subscription-system-admin-migrations"
To add new languages or customize existing translations:
php artisan vendor:publish --tag="subscription-system-admin-lang"
The primary way to use this package is through the Filament plugin configuration:
use NtechServices\SubscriptionSystemAdmin\SubscriptionSystemAdminPlugin;
// In your AdminPanelProvider
SubscriptionSystemAdminPlugin::make()
->subscriptionFeatureUsage(true) // Enable/disable feature usage tracking
->coupons(true) // Enable/disable coupon system
The package automatically registers API routes that you can consume in your frontend applications or mobile apps. All endpoints return structured JSON responses with consistent formatting.
The plugin provides several configuration methods:
SubscriptionSystemAdminPlugin::make()
->subscriptionFeatureUsage(true) // Enable/disable feature usage tracking
->coupons(true) // Enable/disable coupon system
->apiRoutes(true) // Enable/disable API routes
->webRoutes(false) // Enable/disable web routes
When API routes are enabled, you can access the subscription system via REST API. The package provides the following endpoints:
GET /plans - List all subscription plans ([PlanController::class, 'index'])GET /plans/{plan} - Get a specific plan ([PlanController::class, 'show'])GET /plans/{plan}/features - Get plan features ([PlanController::class, 'features'])GET /api/ntech-subscription/plansGET /api/ntech-subscription/plans/{plan}GET /api/ntech-subscription/plans/{plan}/featuresList Plans Response (GET /plans):
{
"success": true,
"data": [
{
"id": 1,
"name": "Basic Plan",
"slug": "basic-plan",
"description": "Perfect for getting started",
"order": 1,
"popular": false,
"trial_value": 7,
"trial_cycle": "days",
"features": [
{
"id": 1,
"name": "API Calls",
"slug": "api-calls",
"description": "Monthly API call limit",
"value": "1000",
"is_soft_limit": true,
"overage_price": "0.01",
"overage_currency": "USD"
}
],
"prices": [
{
"id": 1,
"price": "9.99",
"currency": "USD",
"billing_cycle": "monthly",
"is_active": true,
"feature_overrides": []
}
]
}
]
}
Plan Features with Overrides (GET /plans/{plan}/features):
This endpoint provides a merged view of plan features with price-specific overrides applied, showing the final values that would be used for each billing cycle.
API routes use the middleware defined in your configuration (default: ['api']). For production use, you should add authentication middleware:
// In your config file
'api_middleware' => ['api', 'auth:sanctum'], // or 'auth:api'
When web routes are enabled, you can access the subscription system via web interface at the configured prefix.
This package builds on top of the core ntech-services/subscription-system package. For advanced usage, custom queries, and direct model manipulation, please refer to the underlying package documentation.
You can directly use the underlying models for custom queries:
use NtechServices\SubscriptionSystem\Models\Plan;
use NtechServices\SubscriptionSystem\Models\Feature;
use NtechServices\SubscriptionSystem\Models\Subscription;
// Get all active plans with their features
$activePlans = Plan::with(['features', 'planPrices' => function($query) {
$query->where('is_active', true);
}])->get();
// Get subscription usage for a specific feature
$usage = Subscription::with(['usages' => function($query) use ($featureId) {
$query->where('feature_id', $featureId);
}])->find($subscriptionId);
For comprehensive documentation on models, relationships, and advanced queries, visit: https://packagist.org/packages/ntech-services/subscription-system
The package provides a complete admin interface through Filament where you can:
You can extend the default models by publishing them and modifying as needed. The package is designed to be flexible and allows for extensive customization.
Publish the views and modify them to match your application's design:
php artisan vendor:publish --tag="subscription-system-admin-views"
Add support for additional languages by publishing and modifying the language files:
php artisan vendor:publish --tag="subscription-system-admin-lang"
Run the test suite:
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.
If you encounter any issues or have questions, please:
For commercial support or custom development, please contact Loic NGOU.