PHPackages                             d3yii2/yii2-d3acc - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. d3yii2/yii2-d3acc

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

d3yii2/yii2-d3acc
=================

Yii2 accounting module, accounts and periods

0.4.0(9y ago)33562MITPHPPHP &gt;=5.4.0

Since Feb 7Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/d3yii2/yii2-d3acc)[ Packagist](https://packagist.org/packages/d3yii2/yii2-d3acc)[ RSS](/packages/d3yii2-yii2-d3acc/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)Dependencies (1)Versions (5)Used By (0)

[![Yii2](https://camo.githubusercontent.com/d6b0929173e28cc627430d2519ca1853466a70f37395877eaf4820cb3e1e1909/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f506f77657265645f62792d5969695f4672616d65776f726b2d677265656e2e7376673f7374796c653d666c6174)](https://www.yiiframework.com/)[![Latest Stable Version](https://camo.githubusercontent.com/f0b4f9a6d34bba4dacac6f3dc0ea065dff5f14709600ff851b85ed273e696815/68747470733a2f2f706f7365722e707567782e6f72672f6433796969322f796969322d64336163632f762f737461626c65)](https://packagist.org/packages/d3yii2/yii2-d3acc)[![Total Downloads](https://camo.githubusercontent.com/231c9922d9fe3d56cf8716039b0168f7e71cacfbc0544696ae993790642ccc6c/68747470733a2f2f706f7365722e707567782e6f72672f6433796969322f796969322d64336163632f646f776e6c6f616473)](https://packagist.org/packages/d3yii2/yii2-d3acc)[![Latest Unstable Version](https://camo.githubusercontent.com/9a65bb712adf8bd4c496741df28c029b97786cc97c172c2d50f6020db304417b/68747470733a2f2f706f7365722e707567782e6f72672f6433796969322f796969322d64336163632f762f756e737461626c65)](https://packagist.org/packages/d3yii2/yii2-d3acc)[![License](https://camo.githubusercontent.com/c1cec17c460a364346b2643663e562dfa46588b660a444ca9cdb41652136d6ac/68747470733a2f2f706f7365722e707567782e6f72672f6433796969322f796969322d64336163632f6c6963656e7365)](https://packagist.org/packages/d3yii2/yii2-d3acc)

Accounting
==========

[](#accounting)

This Yii2 module provides support for balance accounting (bookkeeping) system based on debit and credit principles. Provide additinal functionality:

- periods (closing period and period balance)
- dynamicly creating accounts attached one or more tables

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist d3yii2/yii2-d3acc "*"

```

or add

```
"d3yii2/yii2-d3acc": "*"

```

to the require section of your `composer.json` file.

push migration

DB structure
------------

[](#db-structure)

[![DB Schema](https://github.com/d3yii2/yii2-d3acc/raw/master/doc/DbSchema.png "DB Schema")](https://github.com/d3yii2/yii2-d3acc/blob/master/doc/DbSchema.png)

Account definition
------------------

[](#account-definition)

Create object acc

```
use \d3acc\models\AcRecAcc;
use Yii;
/**
 * Description of acc
 *
 * @author Dealer
 */
 class acc
{
    const MONTH_PERIOD = 1;

    const PLAYER_ACC        = 4;
    const EXPENSES          = 10;
    const FOND_PLAYGROUND   = 7;

    acc::CODE_CRD_PLAYGROUND = 'CreditPlaygound';

    /**
     * get player  account
     * @param int $personId
     * @return AcRecAcc
     */
    public static function player($personId)
    {
        return AcRecAcc::getAcc(self::PLAYER_ACC, ['person' => $personId]);
    }

    /**
     * get expenses  account
     * @return AcRecAcc
     */
    public static function expenses()
    {
        return AcRecAcc::getAcc(self::EXPENSES);
    }

    /**
     * get for player playground account
     * @param int $personId
     * @param int $playgroundId
     * @return AcRecAcc
     */
    public static function fondPlayground($personId, $playgroundId)
    {
        return AcRecAcc::getAcc(self::FOND_PLAYGROUND,
                ['person' => $personId, 'playground' => $playgroundId]);
    }
}

```

Transaction registration
------------------------

[](#transaction-registration)

```
       /**
        * player accounts
        */
       $recAccPPG    = acc::playerPlayground($person_id, $playground_id);
       $recAccPlayer = acc::player($person_id);
       $day = date('Y-m-d');
       $tran = AcTran::registre($recAccPlayer, $recAccPPG, $personAmt,
               $day, acc::MONTH_PERIOD, acc::CODE_CRD_PLAYGROUND);
```

Periods
-------

[](#periods)

```
use d3acc\models\AcPeriod;
$acPeriod = AcPeriod::getActivePeriod(acc::MONTH_PERIOD))

//close period
\d3acc\components\PeriodMonth::close(acc::MONTH_PERIOD);
```

Transactions
------------

[](#transactions)

```
 $recAccPlayer = acc::player($person_id);
 $data = AcTran::accPeriodTran($recAccPlayer, $acPeriod);
```

Balance
-------

[](#balance)

```
 $filter  = ['playground' => $playgroundId]
 $playgroundAllPersonBalance = AcTran::accBalanceFilter(acc::FOND_PLAYGROUND, $acPeriod,$filter);

 $filter  = ['person' => $personId]
 $personAllPlaygroundsBalance = AcTran::accBalanceFilter(acc::FOND_PLAYGROUND, $acPeriod,$filter);

 $allPlaygroundsAllPersonBalance = AcTran::accBalanceFilter(acc::FOND_PLAYGROUND, $acPeriod,[]);
```

Define account plan by creating acc class

Add definition record in tables

Migrations with AccConstructor
------------------------------

[](#migrations-with-accconstructor)

```
$constructor = new AccConstructor();
```

Load existind or create new account (ac\_account table) for session

```
$constructor->load($accId);
$constructor->create($code, $name);
```

Add new account dimension (ac\_def table) for loaded/created account

```
$definition = $constructor->addDimension($table, $pkField);
```

Add new extended-account (ac\_rec\_acc table) for loaded/created account

```
$extAccount = $constructor->addExtendedAccount();
```

Add new dimension value (ac\_rec\_ref table) and recalculate label for given extended-account (ac\_rec\_acc table)

```
$constructor->addDimensionRecAcc($extAccount->id, $definition->id, $pk_value);
```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance56

Moderate activity, may be stable

Popularity19

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.1% of commits — single point of failure

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 ~3033 days

Total

2

Last Release

347d ago

Major Versions

0.4.0 → 202305.x-dev2025-05-30

### Community

Maintainers

![](https://www.gravatar.com/avatar/542187ba859514d10d0952dca77df8ea889a9651b249d0b5b513da791fd2919b?d=identicon)[uldisn](/maintainers/uldisn)

---

Top Contributors

[![uldisn](https://avatars.githubusercontent.com/u/3525344?v=4)](https://github.com/uldisn "uldisn (89 commits)")[![baltixAB](https://avatars.githubusercontent.com/u/35080900?v=4)](https://github.com/baltixAB "baltixAB (12 commits)")

---

Tags

accountig

### Embed Badge

![Health badge](/badges/d3yii2-yii2-d3acc/health.svg)

```
[![Health](https://phpackages.com/badges/d3yii2-yii2-d3acc/health.svg)](https://phpackages.com/packages/d3yii2-yii2-d3acc)
```

###  Alternatives

[dmstr/yii2-cookie-consent

Yii2 Cookie Consent Widget

1452.6k](/packages/dmstr-yii2-cookie-consent)

PHPackages © 2026

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