PHPackages                             kodeas/currency - 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. kodeas/currency

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

kodeas/currency
===============

A simple currency cast for Laravel

1.0.5(3y ago)25.3k↓37.9%[2 PRs](https://github.com/Kodeas/currency/pulls)MITPHPPHP ^8.0

Since May 21Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Kodeas/currency)[ Packagist](https://packagist.org/packages/kodeas/currency)[ Docs](https://github.com/kodeas/currency)[ RSS](/packages/kodeas-currency/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (11)Versions (9)Used By (0)

[![currency](https://user-images.githubusercontent.com/56773461/169656521-7f61df41-aaf6-4252-a18b-427fce6688a3.png)](https://user-images.githubusercontent.com/56773461/169656521-7f61df41-aaf6-4252-a18b-427fce6688a3.png)

A simple currency cast for Laravel
==================================

[](#a-simple-currency-cast-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ec911fbf629662a1d5dc6dbe1082acc41249aade0c8a6705a6ea8c14c52c6c81/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b6f646561732f63757272656e63792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kodeas/currency)[![GitHub Tests Action Status](https://camo.githubusercontent.com/a19058d48d42f59f5afb422d8a32c6a0a7b4e957241ab8c7d16f17f19d541ee1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6b6f646561732f63757272656e63792f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/kodeas/currency/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/4f79b6525478b4c2ac21d59b91612a51c9ce38f8b35e1ee6f494effe10d68680/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6b6f646561732f63757272656e63792f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/kodeas/currency/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/9dfb99cbd84ff18ec2ee639c4f4034f2feb19d282c3ac92da67c921d6fda7c09/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b6f646561732f63757272656e63792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kodeas/currency)

This package is created to eliminate the ambiguity involved in storing and retrieving currencies. Currently, for simplicity the terminology surrounding the package is in US currency, however there is nothing stopping anyone from using this for any other 2 decimal currencies.

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

[](#installation)

You can install the package via composer:

```
composer require kodeas/currency
```

Usage
-----

[](#usage)

```
MyModel extends Model
{
    protected $casts = [
        'amount' => Kodeas\Currency\Casts\Currency::class
    ];
}
```

```
$currency = Kodeas\Currency\Currency::fromUsd(1);

$model = MyModel::create([
    'amount' => $currency //100(cents) in database
]);

$model->amount //Currency::class
```

Initialize
----------

[](#initialize)

```
$currency = Kodeas\Currency\Currency::fromUsd(1);
$currency = Kodeas\Currency\Currency::fromCents(100);
```

Methods
-------

[](#methods)

```
echo $currency; // "1.00"
$currency->toUsd(); // "1"
$currency->toCents(); // "100"
$currency->toReadable(); // "1.00"
$currency->toReadable('$'); // "$1.00"
return response()->json(['currency' => $currency->toUsd()]); // {"currency": "1.00"}
```

Credits
-------

[](#credits)

- [Salih Borucu](https://github.com/Kodeas)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 72% 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 ~50 days

Recently: every ~63 days

Total

6

Last Release

1207d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/34669c21c80712dca2f3ec3d8a09754533994e81c875a74b8982dcd0cb9113a9?d=identicon)[kodeas](/maintainers/kodeas)

---

Top Contributors

[![SalihBorucu](https://avatars.githubusercontent.com/u/56773461?v=4)](https://github.com/SalihBorucu "SalihBorucu (36 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (7 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (7 commits)")

---

Tags

laravelcurrencyKodeas

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/kodeas-currency/health.svg)

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

###  Alternatives

[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[hotwired-laravel/stimulus-laravel

Use Stimulus in your Laravel app

3015.3k1](/packages/hotwired-laravel-stimulus-laravel)[cmsmaxinc/filament-system-versions

A comprehensive Filament plugin that provides real-time visibility into all package versions within your Filament PHP application. This essential developer tool creates a centralized dashboard where you can instantly view, monitor, and track the current versions of all installed packages in your project and what the latest version is.

1325.6k](/packages/cmsmaxinc-filament-system-versions)

PHPackages © 2026

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