kodeas/currency
Larablocks Analysis
kodeas/currency works with Laravel 10 to 13 (latest release 1.0.5, Jan 27, 2023).
Laravel 8 and 9 in earlier releases.
Recommendation checks
Not advisedNot advised: no release or commit in over 2 years.
- No release or commit in over 2 years
- Works with Laravel 13, the current version
- No release in the last 12 months (last: Jan 27, 2023)
- 543 downloads a month (needs 10,000)
- 2 GitHub stars (needs 100)
State
Likely abandoned- No release or commit in over 2 years.
- Last stable release: Jan 27, 2023.
- No releases in the last 12 months.
- First released: May 21, 2022.
- Monthly downloads: 543.
- 2 open issues on GitHub.
Data from Packagist and GitHub, checked by Larablocks on Nov 27, 2026.
| Install | |
|---|---|
composer require kodeas/currency |
|
| Latest Version: | 1.0.5 |
| PHP: | ^8.0 |
| Laravel: | 10 – 13 |
| Older releases: | 8 · 9 |
| License: | MIT |
| Last Updated: | Oct 9, 2023 |
| Links: | GitHub · Packagist |

A simple currency cast for Laravel
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
You can install the package via composer:
composer require kodeas/currency
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
$currency = Kodeas\Currency\Currency::fromUsd(1);
$currency = Kodeas\Currency\Currency::fromCents(100);
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
License
The MIT License (MIT). Please see License File for more information.
Related Packages
Cast currency attributes, stored as integer, to floats automatically.
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 1.0.5 | ^8.0 | MIT | ||
| 1.0.4 | ^8.0 | MIT | ||
| 1.0.3 | ^8.0 | ^8.0 | MIT | |
| 1.0.2 | ^8.0 | ^8.0 | MIT | |
| 1.0.1 | ^8.0 | ^8.0 | MIT | |
| 1.0.0 | ^8.0 | ^9.0 | MIT |