PHPackages                             tourze/special-order-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. [Admin Panels](/categories/admin)
4. /
5. tourze/special-order-bundle

ActiveSymfony-bundle[Admin Panels](/categories/admin)

tourze/special-order-bundle
===========================

A Symfony bundle for managing special order offers and chances within e-commerce applications

0.0.1(5mo ago)00MITPHPCI failing

Since Nov 14Pushed 4mo agoCompare

[ Source](https://github.com/tourze/special-order-bundle)[ Packagist](https://packagist.org/packages/tourze/special-order-bundle)[ RSS](/packages/tourze-special-order-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (46)Versions (2)Used By (0)

Special Order Bundle
====================

[](#special-order-bundle)

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

A Symfony bundle for managing special order offers and chances within e-commerce applications. This bundle provides functionality for creating and managing special offer opportunities for users, including product-based rewards and promotional items.

Features
--------

[](#features)

- **Offer Chance Management**: Create and manage special offer opportunities for users
- **Product Integration**: Seamless integration with SPU/SKU product system
- **Admin Interface**: Complete EasyAdmin backend for managing offers and chances
- **JSON-RPC API**: Expose offer data through JSON-RPC procedures
- **Resource Provider**: Support for material prize distribution
- **User-specific Offers**: Personalized offer chances based on user accounts
- **Time-based Validity**: Support for offer expiration and validity periods
- **Doctrine Integration**: Full ORM support with entities and repositories

Installation
------------

[](#installation)

### Requirements

[](#requirements)

- PHP 8.1 or higher
- Symfony 7.3 or higher
- Doctrine ORM
- EasyAdmin Bundle 4.x

### Install via Composer

[](#install-via-composer)

```
composer require tourze/special-order-bundle
```

### Enable the Bundle

[](#enable-the-bundle)

```
// config/bundles.php
return [
    // ...
    Tourze\SpecialOrderBundle\SpecialOrderBundle::class => ['all' => true],
];
```

Configuration
-------------

[](#configuration)

The bundle requires the following dependencies to be properly configured:

```
# config/packages/doctrine.yaml
doctrine:
    dbal:
        # Your database configuration
    orm:
        # Your ORM configuration
```

### Required Dependencies

[](#required-dependencies)

This bundle depends on several other bundles:

- `DoctrineBundle`
- `OrderCoreBundle`
- `SecurityBundle`
- `JsonRPCSecurityBundle`
- `BenefitBundle`
- `ProductCoreBundle`
- `EasyAdminMenuBundle`

Usage
-----

[](#usage)

### Creating Offer Chances

[](#creating-offer-chances)

```
use Tourze\SpecialOrderBundle\Entity\OfferChance;
use Tourze\SpecialOrderBundle\Entity\OfferSku;
use Tourze\ProductCoreBundle\Entity\Sku;

// Create a new offer chance
$offerChance = new OfferChance();
$offerChance->setTitle('Special Discount Offer');
$offerChance->setUser($user);
$offerChance->setStartTime(new \DateTimeImmutable());
$offerChance->setEndTime(new \DateTimeImmutable('+30 days'));
$offerChance->setValid(true);

// Add SKUs to the offer
$offerSku = new OfferSku();
$offerSku->setChance($offerChance);
$offerSku->setSku($sku);
$offerSku->setQuantity(1);
$offerSku->setPrice('99.99');
$offerSku->setCurrency('CNY');

$offerChance->addSku($offerSku);

// Persist the entities
$entityManager->persist($offerChance);
$entityManager->persist($offerSku);
$entityManager->flush();
```

### Using the Resource Provider

[](#using-the-resource-provider)

The bundle includes a resource provider for material prizes:

```
use Tourze\SpecialOrderBundle\Service\SpuOfferResourceProvider;

// The provider is auto-registered and can be used through the resource management system
// It automatically creates offer chances when users receive material prizes
```

### JSON-RPC API

[](#json-rpc-api)

Access user's offer chances through JSON-RPC:

```
{
    "jsonrpc": "2.0",
    "method": "GetOrderOfferChanceList",
    "params": {},
    "id": 1
}
```

Response:

```
{
    "jsonrpc": "2.0",
    "result": {
        "items": [
            {
                "id": "123456789",
                "title": "Special Discount Offer"
            }
        ],
        "total": 1,
        "page": 1,
        "limit": 20
    },
    "id": 1
}
```

Database Schema
---------------

[](#database-schema)

The bundle creates two main database tables:

### order\_offer\_chance

[](#order_offer_chance)

Stores information about special offer opportunities:

- `id`: Primary key (snowflake ID)
- `title`: Offer title
- `user_id`: Associated user
- `start_time`: Offer start time
- `end_time`: Offer expiration time
- `use_time`: When the offer was used
- `valid`: Whether the offer is currently valid
- `contract_id`: Associated contract (if any)
- Timestamps and audit fields

### order\_offer\_sku

[](#order_offer_sku)

Stores SKU information for each offer:

- `id`: Primary key (snowflake ID)
- `chance_id`: Reference to the offer chance
- `sku_id`: Associated product SKU
- `quantity`: Quantity offered
- `price`: Special price
- `currency`: Currency code
- Timestamps and audit fields

Admin Interface
---------------

[](#admin-interface)

The bundle provides EasyAdmin controllers for managing:

- **Offer Chances**: `/admin/order/chance`
- **Offer SKUs**: `/admin/order/sku`

These interfaces allow administrators to:

- Create and edit offer chances
- Manage associated SKUs
- Set validity periods
- Track offer usage

Testing
-------

[](#testing)

Run the test suite:

```
composer test
```

Run PHPStan analysis:

```
composer analyze
```

License
-------

[](#license)

This bundle is released under the MIT License. See the [LICENSE](LICENSE) file for details.

Contributing
------------

[](#contributing)

Contributions are welcome! Please ensure that:

1. All tests pass
2. Code follows PSR-12 standards
3. PHPStan analysis passes
4. Documentation is updated if necessary

Support
-------

[](#support)

For issues and questions:

- Create an issue in the repository
- Check the documentation for common usage patterns
- Review existing issues for solutions

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance77

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity24

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

176d 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-special-order-bundle/health.svg)

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

###  Alternatives

[sylius/sylius

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

8.4k5.6M647](/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.3k](/packages/contao-core-bundle)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[open-dxp/opendxp

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

7310.3k29](/packages/open-dxp-opendxp)[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)

PHPackages © 2026

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