PHPackages                             waxwink/laracount - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. waxwink/laracount

ActiveLibrary[Payment Processing](/categories/payments)

waxwink/laracount
=================

Accounting service for laravel

v0.2(4y ago)07MITPHPPHP ^8.0

Since Oct 24Pushed 4y agoCompare

[ Source](https://github.com/waxwink/laracount)[ Packagist](https://packagist.org/packages/waxwink/laracount)[ RSS](/packages/waxwink-laracount/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (7)Versions (6)Used By (0)

Laravel Accounting System
=========================

[](#laravel-accounting-system)

This package can manage accounting of a Laravel application with an easy approach and great functionalities. These functionalities are

- Deposit and withdrawing from wallet
- Calculating the total existing money received from users (Bank account balance)
- Calculating the total revenue and expenses of the system
- Tax payment can also be handled, and the total amount of paid taxes can be calculated
- Race condition can be handled by lock feature
- Important reports can be produced

Installation
------------

[](#installation)

Installation is pretty straightforward. require the package :

```
composer require waxwink/laracount
```

And then install it :

```
php artisan accounting:install
```

Now we're ready to go.

Basic usage
-----------

[](#basic-usage)

The API is pretty user-friendly as the main service that you are dealing with most of the time is the `AccountingService`. You make an object from the service using container and start using its methods:

```
use Waxwink\Laracount\AccountingService;

$service = app(AccountingService::class);
```

### Deposit

[](#deposit)

Users may deposit to their accounts:

```
$service->deposit($user, 15000);
```

### Withdraw

[](#withdraw)

Users may withdraw from their accounts:

```
$service->withdraw($user, 7000);
```

### Pay

[](#pay)

Users can pay for a service or product or whatever:

```
$service->pay($user, 3000);
```

Laracount does not care about the invoice or the reason of payment, it just takes care of the accounting. But a `ref_id` can be passed in order to track the transactions and use them for reporting purposes. This key can be the **invoice number** or anything.

```
$service->pay($user, 3000, $refId);
```

### PayTo

[](#payto)

The system can also pay to the users. Like the monthly profit or for the service the users have provided like driving, repairing ,...

```
$service->payTo($user, 3000);
```

### Refund

[](#refund)

Users can refund money

```
$service->refund($user, 1000);
```

Laracount does not care about the reason of refund, the amount of it or whether the money has been paid before or not. Like previous methods the transaction can be tracked by a `ref_id` key.

```
$service->pay($user, 1000, $refId);
```

### Balance

[](#balance)

Accounts balance can be retrieved:

```
$service->balance($user);
```

### Other Balance APIs

[](#other-balance-apis)

Bank, revenue and expense balances can be retrieved by:

```
$service->bankBalance();
$service->revenueBalance();
$service->expenseBalance();
$service->bankBalanceByRef($refId);
$service->revenueBalanceByRef($refId);
$service->expenseBalanceByRef($refId);
```

### Transactions list

[](#transactions-list)

Transactions List of an account can be fetched

```
$service->transactionsList($user);
```

You can paginate the transactions this way:

```
$service->transactionsList($user, paginate: true, perPage:5, page:2);
```

Columns can also be defined:

```
$service->transactionsList($user, columns:['balance', 'created_at', 'description']);
```

Items can be sorted like this:

```
$service->transactionsList($user, orderBy: "created_at");
$service->transactionsList($user, orderBy: "created_at", direction:"asc");
```

Date filtering is also available:

```
$service->transactionsList($user, from:"2017-02-01");
$service->transactionsList($user, from:"2017-02-01", to:"2020-01-01");
```

Cool, Right?
------------

[](#cool-right)

A little thing should be taken care of before using the above methods. The users should provide an `account_id` and that ID must be grater than 10 because there the first tens are reserved for the non-user accounts like **bank, revenue, expense, ...**So you must implement the `HasAccount` interface and use the `HasAccountTrait`. So your user model becomes something like this :

```
use Illuminate\Database\Eloquent\Model;
use Waxwink\Accounting\Contracts\HasAccount;
use Waxwink\Laracount\Concerns\HasAccountTrait;

class User extends Model implements HasAccount
{
    use HasAccountTrait;

}
```

Another thing you should know is that the customer should be registered in the `accounts` table. We have a service for that which should be used only once per user (for example when he is registering):

```
$registrationService= app(\Waxwink\Laracount\AccountRegistrationService::class);
$registrationService->registerAccountFor($user);
```

When you put this code in your registering controller it would become something like this:

```
class RegisterController extends Controller

    // .....

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct(protected AccountRegistrationService $accountRegistrationService)
    {
        $this->middleware('guest');
    }

    // ....

    /**
     * Create a new user instance after a valid registration.
     *
     * @param  array  $data
     * @return \App\Models\User
     */
    protected function create(array $data)
    {
        $user = User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => Hash::make($data['password']),
        ]);
        $this->accountRegistrationService->registerAccountFor($user);
        return $user;
    }
    //....
}
```

That's all. Now you are ready to use the above methods.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~6 days

Total

5

Last Release

1635d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/691322b900db6b86519a6d891a39ea59824fc8cb95330303933c81be13a8dbb2?d=identicon)[mohamadreza89](/maintainers/mohamadreza89)

---

Tags

laravelpaymentwalletAccountingtransactiondepositwithdrawwaxwinklaracount

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/waxwink-laracount/health.svg)

```
[![Health](https://phpackages.com/badges/waxwink-laracount/health.svg)](https://phpackages.com/packages/waxwink-laracount)
```

###  Alternatives

[silber/bouncer

Eloquent roles and abilities.

3.6k4.4M25](/packages/silber-bouncer)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[021/laravel-wallet

Reliable and flexible wallet system for Laravel

2785.2k](/packages/021-laravel-wallet)[wnikk/laravel-access-rules

Simple system of ACR (access control rules) for Laravel, with roles, groups, unlimited inheritance and possibility of multiplayer use.

103.6k1](/packages/wnikk-laravel-access-rules)[parsisolution/gateway

A Laravel package for connecting to all Iraninan payment gateways

231.7k](/packages/parsisolution-gateway)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
