Download the PHP package ntech-services/subscription-system without Composer
On this page you can find all versions of the php package ntech-services/subscription-system. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ntech-services/subscription-system
More information about ntech-services/subscription-system
Files in ntech-services/subscription-system
Package subscription-system
Short Description A subscription management system for Laravel applications.
License Apache-2.0
Informations about the package subscription-system
Ntech Services Subscription System
A powerful and flexible subscription management system for Laravel applications, designed to handle subscription plans, payments, and user management.
Table of Contents
- Requirements
- Installation
- Configuration
- Usage
- Commands
- License
Requirements
- PHP 8.0 or higher
- Laravel 8.0 or higher
- Composer
Installation
To install the ntech-services/subscription-system package, follow these steps:
-
Install the package via Composer:
Run the following command in your terminal:
composer require ntech-services/subscription-system - Register Service Provider
After installing the package, you should register the service provider in the bootstrap/providers.php file. Open bootstrap/providers.php and add the following line to the array:
-
Publish the package configuration:
Publish the configuration file to customize the package settings.
php artisan vendor:publish --provider="NtechServices\SubscriptionSystem\SubscriptionSystemServiceProvider" -
Run the migrations:
Migrate the subscription system tables to your database by executing:
php artisan migrate:subscription-system -
Configure your models:
Add the
HasSubscriptionstrait to your user or model class that will handle subscriptions: -
Set up your environment variables:
Update your
.envfile with necessary configurations for the subscription system (if applicable).
Configuration
After publishing the configuration file, you can find it at Config/subscription.php. Customize the settings according to your application's requirements.
Usage
Subscribing to a Plan
To subscribe a user to a plan, you can use the subscribeToPlan method provided by the HasSubscriptions trait:
Managing Subscriptions
You can manage subscriptions using the available methods in the HasSubscriptions trait:
- Check active subscriptions:
$user->activeSubscriptions() - Cancel subscription:
$subscription->cancelSubscription($softCancel = true) - Update subscription plan:
$subscription->updateSubscription($newPlanPrice)
Subscription History
Subscription status changes are automatically recorded in the subscription history for tracking purposes.
Commands
Migrate Subscription System Tables
To migrate the subscription system tables, you can run the following command:
php artisan migrate:subscription-system
License
This package is licensed under the MIT License. See the LICENSE file for details.