New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

kodeas/currency

A simple currency cast for Laravel
8,591 2

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 advised

Not 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
Maintainer: kodeas

currency

A simple currency cast for Laravel

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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

cknow/laravel-money

Laravel Money

5,909,376 1,043
snoeren-development/laravel-currency-casting

Cast currency attributes, stored as integer, to floats automatically.

31,391 5
quicktech-as/exchange-rate

Package Laravel to currency conversion using ExchangeRate API.

35 0
akaunting/laravel-money

Currency formatting and conversion package for Laravel

6,766,388 790
arkecosystem/crypto

A simple PHP Cryptography Implementation for the Ark Blockchain.

142,924 4

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