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.2.0(2mo ago)052↓90%1proprietaryPHP

Since Mar 26Pushed 2mo agoCompare

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

READMEChangelog (2)Dependencies (18)Versions (4)Used By (1)

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.

---

✨ 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
```

---

⚙️ 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

---

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

[](#-future-enhancements)

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

---

🧾 License
---------

[](#-license)

Proprietary

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance88

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

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

Total

3

Last Release

61d 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 (13 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

16445.8k](/packages/relaticle-custom-fields)[dragon-code/laravel-deploy-operations

Performing any actions during the deployment process

244207.7k2](/packages/dragon-code-laravel-deploy-operations)[helgesverre/chromadb

PHP Client for the Chromadb Rest API

321.1k](/packages/helgesverre-chromadb)[a2insights/filament-saas

Filament Saas for A2Insights

171.5k](/packages/a2insights-filament-saas)

PHPackages © 2026

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