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(6mo ago)0141MITPHPPHP ^8.2CI passing

Since Nov 5Pushed 4mo 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 1mo ago

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

35

—

LowBetter than 79% of packages

Maintenance72

Regular maintenance activity

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity48

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

180d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e354fdb316da535dfa8ba2e9193a473c403b6bc6fb9170778d1dc50e304c6e9d?d=identicon)[tourze](/maintainers/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

[sylius/sylius

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

8.4k5.6M651](/packages/sylius-sylius)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[open-dxp/opendxp

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

7310.3k29](/packages/open-dxp-opendxp)

PHPackages © 2026

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