cometcult/credit-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

cometcult/credit-bundle

Composer 安装命令:

composer require cometcult/credit-bundle

包简介

User credit bundle for use with Symfony2

README 文档

README

Build Status Scrutinizer Quality Score

Symfony 2 Bundle for storing user credits/points

Currently supports only Doctrine MongoDB

Installation

Composer

Just add to your composer.json file:

{
    "require": {
        "cometcult/credit-bundle": "dev-master"
    }
}

Application Kernel

Add the bundle to your application's kernel:

// app/AppKernel.php

public function registerBundles()
{
    return array(
        // ...
        new CometCult\CreditsBundle\CometCultCreditsBundle(),
        // ...
    );
}

Usage

CometCultCreditsBundle should be operated from CreditsManager

Create credit instance

$creditsManager = $this->get('comet_cult_credits.manager');
$credit = $creditsManager->createCredit(200, 'abc123');

Then persist credit instance with updateCredit() method

$creditsManager->updateCredit($credit);

Basic operations should be performed providing {ownerId} and amount of credit if needed

$creditsManager->addCredit(100, 'abc123');
$creditsManager->subtractCredit(42, 'abc123');

You can always check the balance of a user with the BalanceChecker

$creditBalanceChecker = $this->get('comet_cult_credits.balance_checker');
$creditBalanceChecker->getCreditBalance('abc123');

Or check against a configurable threshold. By default the minimum threshold is 0 and maximum threshold is 100

$creditBalanceChecker->hasLowCreditBalance('abc123');

Configuration

You can configure your own threshold values. To do that just add to your Symfony config:

comet_cult_credit:
	min_threshold: 0 # min value of your choice
	max_threshold: 100 # max value of your choice

统计信息

  • 总下载量: 276
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 4
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-08-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固