定制 ntech-services/subscription-system 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

ntech-services/subscription-system

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.

ntech-services/subscription-system 适用场景与选型建议

ntech-services/subscription-system 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 40 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 02 月 12 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 ntech-services/subscription-system 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 ntech-services/subscription-system 我们能提供哪些服务?
定制开发 / 二次开发

基于 ntech-services/subscription-system 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

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