PHPackages                             tourze/prepaid-card-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. tourze/prepaid-card-bundle

ActiveSymfony-bundle

tourze/prepaid-card-bundle
==========================

Symfony bundle for prepaid card management system

0.0.2(6mo ago)01MITPHPCI failing

Since Jun 1Pushed 4mo ago1 watchersCompare

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

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

prepaid-card-bundle
===================

[](#prepaid-card-bundle)

[![PHP Version](https://camo.githubusercontent.com/351755b1ea3b8a079461d461cd8142582eb91df14fea214307a660632576b07a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e312532422d626c7565)](https://php.net)[![License](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](LICENSE)[![Build Status](https://camo.githubusercontent.com/b0c6c6845a74cb65a7f0a32bdcfd8fbf80eeb40026c4029af424ab371c94b8bd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6275696c642d70617373696e672d627269676874677265656e)](#)[![Code Coverage](https://camo.githubusercontent.com/08f9e2cc3cc2ac54c1a3318cd1fc74d87e564fe653e479f69ca8a42ee4821c98/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f7665726167652d39352532352d627269676874677265656e)](#)

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

Prepaid card management module - Provides functionality for creating, consuming, balance management and expiration handling of prepaid cards

Features
--------

[](#features)

- **Prepaid Card Management** - Create, activate, recharge, and consume prepaid cards
- **Balance Management** - Real-time balance queries and consumption tracking
- **Expiration Handling** - Automatic checking and processing of expired cards
- **Consumption Records** - Detailed consumption history tracking
- **Contract Management** - Prepaid order and contract association
- **Multiple Card Types** - Support for one-time payment and deposit settlement
- **Automated Tasks** - Scheduled expiration checks and status updates

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

[](#installation)

```
composer require tourze/prepaid-card-bundle
```

Main Entities
-------------

[](#main-entities)

### Card (Prepaid Card)

[](#card-prepaid-card)

- Card number and password management
- Face value and balance tracking
- Status management (valid/expired/insufficient balance)
- Activation time and expiration time

### Consumption (Consumption Record)

[](#consumption-consumption-record)

- Consumption title and amount
- Associated order ID
- Refundable amount management
- Creation time and IP logging

### Contract (Prepaid Contract)

[](#contract-prepaid-contract)

- Prepaid order management
- Cost tracking
- Refund processing
- Consumption record association

Console Commands
----------------

[](#console-commands)

### prepaid-card:expire-check

[](#prepaid-cardexpire-check)

Automatically check and handle expired prepaid cards

```
php bin/console prepaid-card:expire-check
```

**Features:**

- Check cards with expired time and update status to `EXPIRED`
- Check cards with zero balance and update status to `EMPTY`
- Process up to 500 cards per batch
- Automatically executed on schedule (runs every minute)

**Processing Logic:**

1. Find cards with status `VALID` and expired time passed
2. Update these cards' status to `EXPIRED`
3. Find cards with status `VALID` and balance ≤ 0
4. Update these cards' status to `EMPTY`

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

```
use PrepaidCardBundle\Service\PrepaidCardService;

// Inject service
private PrepaidCardService $prepaidCardService;

// Check if balance is sufficient
if ($this->prepaidCardService->hasEnoughBalance($card, $amount)) {
    // Execute consumption
    $this->prepaidCardService->consume($card, $amount, $title);
}
```

### Card Status Management

[](#card-status-management)

```
use PrepaidCardBundle\Enum\PrepaidCardStatus;

// Check card status
if ($card->getStatus() === PrepaidCardStatus::VALID) {
    // Card is valid and can be used
}
```

### Card Types

[](#card-types)

```
use PrepaidCardBundle\Enum\PrepaidCardType;

// One-time full payment
$card->setType(PrepaidCardType::ONE_TIME);

// Deposit with later settlement
$card->setType(PrepaidCardType::AFTER);
```

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

[](#configuration)

Configure in `config/packages/prepaid_card.yaml`:

```
# Prepaid card module configuration
prepaid_card:
    # Expiration check frequency (cron expression)
    expire_check_cron: '* * * * *'
    # Maximum number of cards processed per batch
    batch_size: 500
```

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

[](#database-schema)

- `ims_prepaid_card` - Main prepaid card table
- `ims_prepaid_consumption` - Consumption record table
- `ims_prepaid_contract` - Prepaid contract table
- `ims_prepaid_company` - Card issuing company table
- `ims_prepaid_package` - Card package table
- `ims_prepaid_campaign` - Marketing campaign table

Enum Types
----------

[](#enum-types)

### PrepaidCardStatus (Card Status)

[](#prepaidcardstatus-card-status)

- `VALID` - Valid
- `EXPIRED` - Expired
- `EMPTY` - Insufficient balance
- `INACTIVE` - Not activated

### PrepaidCardType (Card Type)

[](#prepaidcardtype-card-type)

- `ONE_TIME` - One-time full payment
- `AFTER` - Deposit with later settlement

### PrepaidCardExpireType (Expiration Type)

[](#prepaidcardexpiretype-expiration-type)

- `SAME_WITH_CARD` - Same as card validity period
- `AFTER_ACTIVATION` - After activation

Events and Listeners
--------------------

[](#events-and-listeners)

The module provides the following events:

- Card creation event
- Consumption record creation event
- Balance change event
- Status change event

Extensibility
-------------

[](#extensibility)

You can extend functionality through:

- Implementing custom card types
- Adding additional consumption validation rules
- Customizing expiration handling logic
- Integrating third-party payment systems

Reference Documentation
-----------------------

[](#reference-documentation)

- [Prepaid Card Design Principles](https://blog.csdn.net/zhichaosong/article/details/120316738)
- [Symfony Bundle Development Guide](https://symfony.com/doc/current/bundles.html)

License
-------

[](#license)

This project is licensed under the MIT License - see the LICENSE file for details.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance72

Regular maintenance activity

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity28

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

Every ~165 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 (2 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tourze-prepaid-card-bundle/health.svg)

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

###  Alternatives

[sylius/sylius

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

8.4k5.6M651](/packages/sylius-sylius)[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)[sulu/sulu

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

1.3k1.3M152](/packages/sulu-sulu)[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)
