PHPackages                             3neti/cash - 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. [Database &amp; ORM](/categories/database)
4. /
5. 3neti/cash

ActiveLibrary[Database &amp; ORM](/categories/database)

3neti/cash
==========

A package to enable assigning cash to Eloquent Models

v1.3.0(1w ago)0345↓52.6%2proprietaryPHPPHP ^8.3CI passing

Since Mar 26Pushed 1w agoCompare

[ Source](https://github.com/3neti/cash)[ Packagist](https://packagist.org/packages/3neti/cash)[ RSS](/packages/3neti-cash/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (27)Versions (5)Used By (2)

3neti/cash
==========

[](#3neticash)

A lightweight Laravel package for representing **monetary value as a first-class model**, with support for:

- precise money handling (via Brick\\Money)
- wallet integration (via Bavix Wallet)
- status lifecycle (via Spatie Model Status)
- tagging (via Spatie Tags)
- metadata and expiration handling

This package is designed as a **supporting domain layer** for the x-change ecosystem, particularly for voucher issuance, redemption, and disbursement workflows.

---

Supported platforms
-------------------

[](#supported-platforms)

- PHP 8.3 and 8.4
- Laravel 12 and 13
- `3neti/wallet` 1.x and 2.x

Laravel 12 and Laravel 13 are tested as separate compatibility lanes.

---

✨ Core Concept
--------------

[](#-core-concept)

`Cash` is a **value container**:

- it represents an amount of money
- it can be tagged, status-tracked, and expired
- it can be linked to any model via `reference`
- it integrates with wallet systems for transfer and settlement

It is **not a ledger**
It is **not a wallet**

It is a **portable monetary unit** used across workflows.

---

📦 Installation
--------------

[](#-installation)

```
composer require 3neti/cash:^1.3
```

---

⚙️ Configuration
----------------

[](#️-configuration)

Publish config (optional):

```
php artisan vendor:publish --tag=config
```

---

🧱 Database Migrations
---------------------

[](#-database-migrations)

This package uses:

```
loadMigrationsFrom()
```

So migrations are **auto-loaded**.

Run:

```
php artisan migrate
```

---

⚠️ Migration Prerequisites
--------------------------

[](#️-migration-prerequisites)

This package depends on the following schema:

- `spatie/laravel-model-status` → `statuses` table
- `spatie/laravel-tags` → `tags` tables
- `3neti/wallet` / `bavix/laravel-wallet` → wallet tables

👉 These must be installed and migrated by the host application.

This package **does NOT publish or manage those migrations**.

---

🧠 Usage
-------

[](#-usage)

### Creating Cash

[](#creating-cash)

```
use LBHurtado\Cash\Models\Cash;

$cash = Cash::create([
    'amount' => 1500.00,
    'currency' => 'PHP',
    'meta' => ['note' => 'Transport support'],
]);
```

---

### Using Money Object

[](#using-money-object)

```
use Brick\Money\Money;

$cash = Cash::create([
    'amount' => Money::of(1500, 'PHP'),
    'currency' => 'PHP',
]);
```

Stored internally as **minor units**.

---

### Accessing Amount

[](#accessing-amount)

```
$cash->amount; // Brick\Money\Money instance
$cash->amount->getAmount()->toFloat(); // 1500.00
$cash->amount->getMinorAmount()->toInt(); // 150000
```

---

### Metadata

[](#metadata)

```
$cash->meta->note;
$cash->meta['note'];
```

---

### Expiration

[](#expiration)

```
$cash->expired = true;
$cash->save();

$cash->expired; // true
```

---

### Status Management

[](#status-management)

```
use LBHurtado\Cash\Enums\CashStatus;

$cash->setStatus(CashStatus::DISBURSED);

$cash->hasStatus(CashStatus::DISBURSED);
$cash->getCurrentStatus();
```

---

### Secret Protection

[](#secret-protection)

```
$cash->secret = '1234';
$cash->save();

$cash->verifySecret('1234'); // true
```

---

### Redemption Check

[](#redemption-check)

```
$cash->canRedeem('1234');
```

---

### Tags

[](#tags)

```
$cash->attachTag('transport');
$cash->tags;
```

---

### Wallet Integration

[](#wallet-integration)

```
$cash->depositFloat(1000);
$cash->withdrawFloat(500);
```

---

🧾 Data Transformation
---------------------

[](#-data-transformation)

Use `CashData` for API responses:

```
use LBHurtado\Cash\Data\CashData;

CashData::fromModel($cash);
```

---

🧱 Schema
--------

[](#-schema)

```
cash
- id
- amount (minor units)
- currency
- reference_type
- reference_id
- meta (json)
- secret (hashed)
- expires_on
- timestamps

```

---

🧩 Relationships
---------------

[](#-relationships)

- morphTo: `reference`
- morphOne: `withdrawTransaction`
- statuses (Spatie)
- tags (Spatie)
- wallet (Bavix)

---

🧪 Testing
---------

[](#-testing)

This package uses:

- Testbench
- in-memory SQLite
- test-only migrations under `tests/database/migrations`

No vendor migrations are required for tests.

---

🧭 Architecture Role
-------------------

[](#-architecture-role)

In the **x-change ecosystem**:

- `cash` = monetary payload
- `voucher` = contract/instruction
- `wallet` = balance + ledger
- `x-change` = orchestration

---

🔒 Design Principles
-------------------

[](#-design-principles)

- Money is always stored in **minor units**
- Currency is explicit
- Status is first-class
- Expiration is built-in
- Metadata is flexible
- Secrets are hashed

---

Withdrawal authorization
------------------------

[](#withdrawal-authorization)

Cash withdrawal policy is exposed through container-resolved contracts for:

- amount bounds;
- withdrawal intervals;
- claimant authorization;
- vendor mandates;
- approval policy; and
- typed authorization decisions.

The default decision service reports whether a withdrawal is allowed or requires an independent approval. It does not dispatch a provider transfer or manufacture approval evidence. The integrating settlement system remains responsible for authenticating the officer, persisting authorization evidence, and invoking execution.

Resolve these services through Laravel's container so applications may replace policy implementations without changing Cash models.

---

🚀 Future Enhancements
---------------------

[](#-future-enhancements)

- reconciliation support
- audit integration
- stricter immutability enforcement
- event hooks

---

🧾 License
---------

[](#-license)

Proprietary

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance98

Actively maintained with recent releases

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~42 days

Total

4

Last Release

9d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/586e1ed70140038e6348728222adbcf68bfc4455b1f94a4f8bcbe57917a63d57?d=identicon)[3neti](/maintainers/3neti)

---

Top Contributors

[![3neti](https://avatars.githubusercontent.com/u/89447696?v=4)](https://github.com/3neti "3neti (16 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/3neti-cash/health.svg)

```
[![Health](https://phpackages.com/badges/3neti-cash/health.svg)](https://phpackages.com/packages/3neti-cash)
```

###  Alternatives

[relaticle/custom-fields

User Defined Custom Fields for Laravel Filament

16461.2k](/packages/relaticle-custom-fields)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

762297.9k51](/packages/civicrm-civicrm-core)[dragon-code/laravel-deploy-operations

Performing any actions during the deployment process

244248.0k3](/packages/dragon-code-laravel-deploy-operations)[filament/spatie-laravel-tags-plugin

Filament support for `spatie/laravel-tags`.

392.0M61](/packages/filament-spatie-laravel-tags-plugin)

PHPackages © 2026

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