承接 tecmetrix/subscription-system 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

tecmetrix/subscription-system

最新稳定版本:v1.0.0

Composer 安装命令:

composer require tecmetrix/subscription-system

包简介

Laravel subscription system package for multi-company accounting and service management.

README 文档

README

A flexible Laravel Subscription Management Package for multi-company applications.
It allows you to define services, create packages, and manage subscriptions for each company — including subscription duration, start & end dates, and automatic expiration.

🚀 Features

✅ Create and manage services (e.g., Accounting, Payroll, CRM, etc.)
✅ Combine services into packages (Free, Basic, Pro, Enterprise, etc.)
✅ Manage subscriptions for each company
✅ Automatic expiration via Artisan command
✅ Fully configurable and extendable
✅ Built with Laravel best practices

🧱 Installation

Step 1 — Require the Package

composer require tecmetrix/subscription-system

💡 If it’s a private repository, add it in your app’s composer.json:

"repositories": [
  {
    "type": "vcs",
    "url": "https://github.com/tecmetrix/subscription-system.git"
  }
]

Step 2 — Publish & Run Migrations

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

This will create the following tables:

  • services
  • packages
  • package_service
  • subscriptions

Step 3 — Add to Your Models (Optional)

If you have a Company model, each company can have one or more subscriptions.

Example:

use Tecmetrix\SubscriptionSystem\Models\Subscription;

class Company extends Model
{
    public function subscriptions()
    {
        return $this->hasMany(Subscription::class);
    }
}

⚙️ Usage

🧩 1. Create Services

use Tecmetrix\SubscriptionSystem\Models\Service;

$service = Service::create([
    'name' => 'CRM Module',
    'description' => 'Manage customers and sales data'
]);

📦 2. Create a Package with Multiple Services

use Tecmetrix\SubscriptionSystem\Models\Package;

$package = Package::create([
    'name' => 'Pro Plan',
    'description' => 'Includes CRM and Accounting modules',
    'price' => 49.99,
    'duration_days' => 30, // monthly plan
]);

$package->services()->attach([$service->id]);

🧾 3. Subscribe a Company to a Package

use Tecmetrix\SubscriptionSystem\Models\Subscription;
use Carbon\Carbon;

Subscription::create([
    'company_id' => 1,
    'package_id' => $package->id,
    'start_date' => Carbon::now(),
    'end_date' => Carbon::now()->addDays($package->duration_days),
    'status' => 'active',
]);

⏳ 4. Check Subscription Validity

$subscription = Subscription::where('company_id', 1)->latest()->first();

if ($subscription && $subscription->isActive()) {
    echo "Your subscription is active!";
} else {
    echo "Please renew your subscription.";
}

🕒 5. Auto Expire Old Subscriptions

The package provides a built-in Artisan command:

php artisan subscriptions:expire

This will mark all expired subscriptions as expired.

You can schedule this in app/Console/Kernel.php:

$schedule->command('subscriptions:expire')->daily();

🧰 Configuration

You can publish the config file to customize table names or other settings:

php artisan vendor:publish --tag=config

🧪 Example Workflow

  1. Create 3 services: Accounting, CRM, HRM
  2. Create 2 packages:
    • Basic → includes Accounting
    • Pro → includes Accounting + CRM + HRM
  3. Subscribe a company to the Pro package for 1 year
  4. The system automatically expires subscriptions after 365 days

🧩 Directory Structure

src/
 ┣━━ Models/
 ┃   ┣━━ Service.php
 ┃   ┣━━ Package.php
 ┃   ┗━━ Subscription.php
 ┣━━ Console/
 ┃   ┗━━ Commands/ExpireSubscriptions.php
 ┣━━ Database/
 ┃   ┗━━ migrations/
 ┣━━ Providers/
 ┃   ┗━━ SubscriptionSystemServiceProvider.php

🧑‍💻 Artisan Commands

Command Description
php artisan subscriptions:expire Expires old subscriptions

🧾 License

This package is licensed under the MIT License.
Copyright (c) 2025 Tecmetrix

💬 Support

For issues, suggestions, or contributions:
📧 Email: support@tecmetrix.com
🌐 Website: https://tecmetrix.com

Developed with ❤️ by Tecmetrix

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-11-06