PHPackages                             tourze/product-limit-rule-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. tourze/product-limit-rule-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

tourze/product-limit-rule-bundle
================================

产品限制规则管理包，用于管理 SPU 和 SKU 的限制规则

1.0.1(7mo ago)0141MITPHPPHP ^8.2CI passing

Since Nov 5Pushed 6mo agoCompare

[ Source](https://github.com/tourze/product-limit-rule-bundle)[ Packagist](https://packagist.org/packages/tourze/product-limit-rule-bundle)[ RSS](/packages/tourze-product-limit-rule-bundle/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (41)Versions (3)Used By (1)

Product Limit Rule Bundle
=========================

[](#product-limit-rule-bundle)

[English](README.md) | [中文](README.zh-CN.md)

产品限制规则管理包，用于管理 SPU 和 SKU 的限制规则。

功能特性
----

[](#功能特性)

- **SPU 限制规则**：支持对 SPU 的各种限购规则配置
- **SKU 限制规则**：支持对 SKU 的各种限购规则配置
- **多种限制类型**：支持按时间、数量、互斥等多种限制类型
- **易于扩展**：基于枚举的类型系统，便于添加新的限制类型

安装
--

[](#安装)

```
composer require tourze/product-limit-rule-bundle
```

使用方法
----

[](#使用方法)

### 1. 注册 Bundle

[](#1-注册-bundle)

在 `config/bundles.php` 中添加：

```
return [
    // ...
    Tourze\ProductLimitRuleBundle\ProductLimitRuleBundle::class => ['all' => true],
];
```

### 2. SPU 限制规则

[](#2-spu-限制规则)

```
use Tourze\ProductLimitRuleBundle\Entity\SpuLimitRule;
use Tourze\ProductLimitRuleBundle\Enum\SpuLimitType;

// 创建 SPU 每日限购规则
$limitRule = new SpuLimitRule();
$limitRule->setSpuId('spu-123');
$limitRule->setType(SpuLimitType::BUY_DAILY);
$limitRule->setValue('10'); // 每日限购10件
```

### 3. SKU 限制规则

[](#3-sku-限制规则)

```
use Tourze\ProductLimitRuleBundle\Entity\SkuLimitRule;
use Tourze\ProductLimitRuleBundle\Enum\SkuLimitType;

// 创建 SKU 最低购买数量规则
$limitRule = new SkuLimitRule();
$limitRule->setSkuId('sku-456');
$limitRule->setType(SkuLimitType::MIN_QUANTITY);
$limitRule->setValue('3'); // 最低购买3件
```

支持的限制类型
-------

[](#支持的限制类型)

### SPU 限制类型 (SpuLimitType)

[](#spu-限制类型-spulimittype)

- `BUY_TOTAL` - 总次数限购
- `BUY_YEAR` - 按年度限购
- `BUY_QUARTER` - 按季度限购
- `BUY_MONTH` - 按月度限购
- `BUY_DAILY` - 按日限购
- `SPECIFY_COUPON` - 特定优惠券购买
- `SPU_MUTEX` - SPU购买互斥
- `BUY_MONTH_STORE` - 按月度门店限购
- `BUY_QUARTER_STORE` - 按季度门店限购
- `BUY_YEAR_STORE` - 按年度门店限购
- `BUY_STORE_TOTAL` - 按门店总次数限购

### SKU 限制类型 (SkuLimitType)

[](#sku-限制类型-skulimittype)

- `BUY_TOTAL` - 总次数限购
- `BUY_YEAR` - 按年度限购
- `BUY_QUARTER` - 按季度限购
- `BUY_MONTH` - 按月度限购
- `BUY_DAILY` - 按日限购
- `SPECIFY_COUPON` - 特定优惠券购买
- `SKU_MUTEX` - SKU购买互斥
- `MIN_QUANTITY` - 最低购买数量

许可证
---

[](#许可证)

MIT License

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance65

Regular maintenance activity

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~8 days

Total

2

Last Release

234d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/13899502?v=4)[tourze](/maintainers/tourze)[@tourze](https://github.com/tourze)

---

Top Contributors

[![tourze](https://avatars.githubusercontent.com/u/13899502?v=4)](https://github.com/tourze "tourze (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tourze-product-limit-rule-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/tourze-product-limit-rule-bundle/health.svg)](https://phpackages.com/packages/tourze-product-limit-rule-bundle)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1616.4k14](/packages/2lenet-crudit-bundle)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9421.6k61](/packages/open-dxp-opendxp)[oro/platform

Business Application Platform (BAP)

645143.5k115](/packages/oro-platform)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M739](/packages/sylius-sylius)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.8M508](/packages/pimcore-pimcore)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
