2017 © Pedro Peláez
 

symfony-bundle credit-bundle

User credit bundle for use with Symfony2

image

cometcult/credit-bundle

User credit bundle for use with Symfony2

  • Monday, December 16, 2013
  • by grEvenX
  • Repository
  • 4 Watchers
  • 1 Stars
  • 266 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

CometCultCreditsBundle

Build Status Scrutinizer Quality Score, (*1)

Symfony 2 Bundle for storing user credits/points, (*2)

Currently supports only Doctrine MongoDB, (*3)

Installation

Composer

Just add to your composer.json file:, (*4)

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

Application Kernel

Add the bundle to your application's kernel:, (*5)

// app/AppKernel.php

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

Usage

CometCultCreditsBundle should be operated from CreditsManager, (*6)

Create credit instance, (*7)

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

Then persist credit instance with updateCredit() method, (*8)

$creditsManager->updateCredit($credit);

Basic operations should be performed providing {ownerId} and amount of credit if needed, (*9)

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

You can always check the balance of a user with the BalanceChecker, (*10)

$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, (*11)

$creditBalanceChecker->hasLowCreditBalance('abc123');

Configuration

You can configure your own threshold values. To do that just add to your Symfony config:, (*12)

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

The Versions

16/12 2013

dev-master

9999999-dev https://github.com/cometcult/CometCultCreditsBundle

User credit bundle for use with Symfony2

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

The Development Requires

by JRL

credit balance

16/12 2013