Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Credit Bundle Laravel Package

cometcult/credit-bundle

View on GitHub
Deep Wiki
Context7

CometCultCreditsBundle

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
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope