tecmetrix/subscription-system
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:
servicespackagespackage_servicesubscriptions
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
- Create 3 services: Accounting, CRM, HRM
- Create 2 packages:
- Basic → includes Accounting
- Pro → includes Accounting + CRM + HRM
- Subscribe a company to the Pro package for 1 year
- 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
tecmetrix/subscription-system 适用场景与选型建议
tecmetrix/subscription-system 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 11 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 tecmetrix/subscription-system 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tecmetrix/subscription-system 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-11-06