PHPackages                             halumein/yii2-cashbox-module - 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. halumein/yii2-cashbox-module

ActiveYii2-extension

halumein/yii2-cashbox-module
============================

cashbox

1270PHP

Since Sep 13Pushed 8y ago4 watchersCompare

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

READMEChangelogDependenciesVersions (8)Used By (0)

Yii2-cashbox-module
===================

[](#yii2-cashbox-module)

```
composer require halumein/yii2-cashbox-module "*"

```

миграции:

```
php yii migrate --migrationPath=vendor/halumein/yii2-cashbox-module/migrations

```

В конфигурационный файл приложения добавить модуль cashbox

```
    'modules' => [
        'cashbox' => [
            'class' => 'halumein\cashbox\Module',
        ],
        //...
    ]
```

Дополнительные параметры:

```
    'modules' => [
        'cashbox' => [
            'class' => 'halumein\cashbox\Module',
            'userModel' => 'common\models\YourUser', // класс пользователя используемый в приложении. если не указан то Yii::$app->user->identity
            'paymentSuccessRedirect' => '/order/order/print',  //редирект после успешной оплаты
            'printRedirect' => '/order/order/print' // редирект на action печати чека после оплаты
            'payedStatus' => 'payed', // для простановки статусов в ордере "оплачен"
            'halfpayedStatus' => 'halfpayed', // для простановки статусов в ордере "частично оплачен"
            'lessSumPaymentTypes' => [5], // тип оплаты в котором сумма платжа допустима быть меньше суммы заказа

            // для автоподстановки кассы в зависимости от типа оплаты из виджета заказа в виджет формы оплаты
            'paymentTypeToCashbox' => [
                1 => 1, // id типа оплаты => id кассы
            ],

            // для формирования ссылок в списке операций
            'linksToViews' => [
                'dvizh\order\models\Order' => [
                    'viewUrl' => '/order/order/view',
                    'itemIdField' => 'id'
                ]
            ],
        ],
        //...
    ]
```

В используемую модель пользователя добавить реализации необходимых методов. Например, могут выглядеть так:

```
use halumein\cashbox\models\Cashbox; //модель кассы

class YourUser extends ActiveRecord implements \halumein\cashbox\interfaces\User
{
    ...
        public function getId()
        {
            return $this->getPrimaryKey();
        }

        public function setDefaultCashbox($cashboxId)
        {
             $this->default_cashbox = $cashboxId;
             return $this->save(false);
        }

        public function getDefaultCashbox()
        {
            return $this->default_cashbox;
        }

        public function getName($id = null)
        {
            return $this->userProfile->getName();
        }

        public function getFullName($id = null)
        {
            return $this->userProfile->getFullName();
        }

        // для получения доступных касс пользователю
        public function getCashboxes()
        {
            return $this->hasMany(Cashbox::className(), ['id' => 'cashbox_id'])
                        ->viaTable('cashbox_user_to_cashbox', ['user_id' => 'id']);
        }

    ...
}

```

дальше обращаться по адресу cashbox/&lt;имя\_контроллера&gt; доуступные роуты:

```
cashbox/cashbox - индекс касс
cashbox/operation - индекс транзакций
cashbox/exchange - индекс переводов между кассами
cashbox/revision - индекс сверок

```

Виджет выбора дефолтной кассы: Для использования виджета потребуется дополнить таблицу пользователя в базе данных полем "default\_cashbox", куда будет записываться id кассы по умолчанию для выбранного пользователя.

Вывод виджета

```

```

Доступные методы компонента:

```
    Yii::$app->cashbox->addTransaction();
    Yii::$app->cashbox->getIncomeSumByPeriod();
    Yii::$app->cashbox->getIncomeSumByPeriod();

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60.7% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/ca61f99bdb01eb0f458944223a12e55575f73c4ffc6965259e2b96a8bbc26cee?d=identicon)[halumein](/maintainers/halumein)

---

Top Contributors

[![halumein](https://avatars.githubusercontent.com/u/5361342?v=4)](https://github.com/halumein "halumein (74 commits)")[![pistol88](https://avatars.githubusercontent.com/u/8104605?v=4)](https://github.com/pistol88 "pistol88 (25 commits)")[![slam-mt](https://avatars.githubusercontent.com/u/20283374?v=4)](https://github.com/slam-mt "slam-mt (14 commits)")[![AlChilyakov](https://avatars.githubusercontent.com/u/18215959?v=4)](https://github.com/AlChilyakov "AlChilyakov (9 commits)")

### Embed Badge

![Health badge](/badges/halumein-yii2-cashbox-module/health.svg)

```
[![Health](https://phpackages.com/badges/halumein-yii2-cashbox-module/health.svg)](https://phpackages.com/packages/halumein-yii2-cashbox-module)
```

PHPackages © 2026

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