ntech-services/subscription-system 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ntech-services/subscription-system

最新稳定版本:0.0.17

Composer 安装命令:

composer require ntech-services/subscription-system

包简介

A subscription management system for Laravel applications.

README 文档

README

A powerful and flexible subscription management system for Laravel applications, designed to handle subscription plans, payments, and user management.

Table of Contents

Requirements

  • PHP 8.0 or higher
  • Laravel 8.0 or higher
  • Composer

Installation

To install the ntech-services/subscription-system package, follow these steps:

  1. Install the package via Composer:

    Run the following command in your terminal:

composer require ntech-services/subscription-system

  1. 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:

[
    App\Providers\AppServiceProvider::class,
    NtechServices\SubscriptionSystem\SubscriptionServiceProvider::class, // add this line to providers array
];
  1. Publish the package configuration:

    Publish the configuration file to customize the package settings.

php artisan vendor:publish --provider="NtechServices\SubscriptionSystem\SubscriptionSystemServiceProvider"

  1. Run the migrations:

    Migrate the subscription system tables to your database by executing:

php artisan migrate:subscription-system

  1. Configure your models:

    Add the HasSubscriptions trait to your user or model class that will handle subscriptions:

 use NtechServices\SubscriptionSystem\Traits\HasSubscriptions;

 class User extends Authenticatable
 {
     use HasSubscriptions;
 }
  1. Set up your environment variables:

    Update your .env file 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:

$user = User::find(1);
$planPrice = PlanPrice::find(1); // Retrieve the desired plan

$user->subscribeToPlan($planPrice, $couponCode = null);

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.

统计信息

  • 总下载量: 40
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2025-02-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固