PHP code example of cometcult / credit-bundle

1. Go to this page and download the library: Download cometcult/credit-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

cometcult / credit-bundle example snippets


// app/AppKernel.php

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

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

$creditsManager->updateCredit($credit);

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

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

$creditBalanceChecker->hasLowCreditBalance('abc123');