Download the PHP package roboticsexpert/balance-manager without Composer

On this page you can find all versions of the php package roboticsexpert/balance-manager. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package balance-manager

Laravel Balance manager

in many projects, you need to have credit (balance) concept for your user that make you distract from your main business logic.

with this package you will have balance for your users easily without being worry about Race Condition and Double Spending.

this project mainly designed for exchange systems, but you can use it in any project.

Installation

after instaling composer package, if you use auto discovery for service providers, everything ok, but if you blocked that just add this line to config/app.php in providers section:

after that you should run

and this:

it will create balance.php file in your config file.

Usage

First of all, you should decide with currencies you want to have in your system, and consider a KEY for each currency and add those keys in balance.php config file

you can use this project with 2 strategy,Facade or Dependency injection!

I suggest to you to use it with dependecy injection for IDE auto complete feature but use it as you prefer!

after that you can get BalanceManager from with these to methods:

Facade

you can get BalanceManager service like this:

Dependency Injection

you can get BalanceManager service from app() like this:

or get from laravel automatic dependency injection

Methods

Get all balance for user

it will return array of Balance model

Change balance of user


$balanceChangeResult= $balanceManager->changeBalanceByUserIdAndCurrency(
        int $userId, //user id
        string $currency, // like USDT, TMN
        string $reason, // a unique string for each action
        IBalanceHistoryRelated $model, // a model that is author of change balance
        Decimal $valueChange, // value you want to add or sub from user balance
        Decimal $lockedValueChange // in general usage it should be new \Decimal\Decimal(0)
);

All versions of balance-manager with dependencies

PHP Build Version
Package Version
Requires ext-decimal Version *
roboticsexpert/laravel-decimal Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package roboticsexpert/balance-manager contains the following files

Loading the files please wait ....