PHPackages                             rogervila/moneyphp-operations - 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. rogervila/moneyphp-operations

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

rogervila/moneyphp-operations
=============================

Helpers for manipulating money with MoneyPHP

1.5.0(2y ago)31.3k[1 PRs](https://github.com/rogervila/moneyphp-operations/pulls)MITPHPCI passing

Since Jan 14Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/rogervila/moneyphp-operations)[ Packagist](https://packagist.org/packages/rogervila/moneyphp-operations)[ RSS](/packages/rogervila-moneyphp-operations/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (4)Versions (10)Used By (0)

[![MoneyPHP Operations](https://camo.githubusercontent.com/10f93724ba855c71d035f387f15fda5a6ca65b219e8a594fad3112c6831b64bd/68747470733a2f2f692e6962622e636f2f59705647525a502f6d6f6e65792d6d616e6167656d656e742e706e67)](https://camo.githubusercontent.com/10f93724ba855c71d035f387f15fda5a6ca65b219e8a594fad3112c6831b64bd/68747470733a2f2f692e6962622e636f2f59705647525a502f6d6f6e65792d6d616e6167656d656e742e706e67)

[![Build Status](https://github.com/rogervila/moneyphp-operations/workflows/build/badge.svg)](https://github.com/rogervila/moneyphp-operations/actions)[![StyleCI](https://camo.githubusercontent.com/57469eb791b3c9b7d9c1d0fa74aed022b020830c172d4fb4d04a25b376e64df2/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3538383535363533342f736869656c643f6272616e63683d6d61696e)](https://github.styleci.io/repos/588556534)[![Quality Gate Status](https://camo.githubusercontent.com/f1bcd24e57cd768ef336203fb0f41f6f31ecc9b25a10876da6abb14108f53f10/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d726f67657276696c615f6d6f6e65797068702d6f7065726174696f6e73266d65747269633d616c6572745f737461747573)](https://sonarcloud.io/dashboard?id=rogervila_moneyphp-operations)

[![Latest Stable Version](https://camo.githubusercontent.com/c685330ef7134b8eac06f2699c4be21e47a65a466644032caf36ea91d25ffcc0/68747470733a2f2f706f7365722e707567782e6f72672f726f67657276696c612f6d6f6e65797068702d6f7065726174696f6e732f762f737461626c65)](https://packagist.org/packages/rogervila/moneyphp-operations)[![Total Downloads](https://camo.githubusercontent.com/9246aaa4a827388aa2498ffa300b78e19a99ca908cc076195acf57dbce111115/68747470733a2f2f706f7365722e707567782e6f72672f726f67657276696c612f6d6f6e65797068702d6f7065726174696f6e732f646f776e6c6f616473)](https://packagist.org/packages/rogervila/moneyphp-operations)[![License](https://camo.githubusercontent.com/f597ed18f38dda7e422cb78a5c1d0d9c9b0ffbae7dff4ad56fdd004f7163503e/68747470733a2f2f706f7365722e707567782e6f72672f726f67657276696c612f6d6f6e65797068702d6f7065726174696f6e732f6c6963656e7365)](https://packagist.org/packages/rogervila/moneyphp-operations)

MoneyPHP Operations
===================

[](#moneyphp-operations)

About
-----

[](#about)

MoneyPHP Operations brings a set of helpers to manipulate money with [MoneyPHP](https://www.moneyphp.org).

Install
-------

[](#install)

```
composer require rogervila/moneyphp-operations

```

Usage
-----

[](#usage)

> Note: Pull requests with new helpers are welcome!

### Percentage increase

[](#percentage-increase)

```
use Money\Money;
use MoneyOperation\Operation;

$money = Money::EUR('100'); // 1€

$increasedMoney = Operation::of($money)->percentageIncrease('20') // 1.20€
```

### Percentage decrease

[](#percentage-decrease)

```
use Money\Money;
use MoneyOperation\Operation;

$money = Money::EUR('288'); // 2.88€

// percentageDecrease accepts positive and negative numeric strings
$decreasedMoney = Operation::of($money)->percentageDecrease('2.99') // 2.79€
$decreasedMoney = Operation::of($money)->percentageDecrease('-2.99') // 2.79€
```

### Percentage difference

[](#percentage-difference)

```
use Money\Money;
use MoneyOperation\Operation;

$moneyA = Money::EUR('100'); // 1€
$moneyB = Money::EUR('120'); // 1.20€

// Returns a float. Use number_format to format the result
$percentage = Operation::of($moneyA)->percentageDifference($moneyB) // 20.0
```

### Split

[](#split)

```
use Money\Money;
use MoneyOperation\Operation;

$money = Money::EUR('1000'); // 10€

/**
 * Will try to increase the first part when cannot be split equally
 * Throws \MoneyOperation\Exceptions\InvalidOperationException when cannot be split at all (for very low values mainly)
 */
$parts = Operation::of($money)->split(3) // [Money::EUR('334'), Money::EUR('333'), Money::EUR('333')]
```

### Join

[](#join)

```
use Money\Money;
use MoneyOperation\Operation;

$parts = [Money::EUR('334'), Money::EUR('333'), Money::EUR('333')];

$money = Operation::join($parts) // 10€
```

### Average

[](#average)

```
use Money\Money;
use MoneyOperation\Operation;

$parts = [Money::EUR('100'), Money::EUR('200'), Money::EUR('300'), Money::EUR('400')];

$money = Operation::average($parts) // 2,50€
```

### Format

[](#format)

```
use Money\Money;
use MoneyOperation\Operation;

/**
 * Uses \Money\Formatter\IntlMoneyFormatter
 * Throws \MoneyOperation\Exceptions\InvalidOperationException when intl extension is not available
 */
$money = Operation::of(Money::USD('100'))->format('en_US') // $1.00
```

### Parse

[](#parse)

```
use Money\Money;
use MoneyOperation\Operation;

/**
 * Uses \Money\Parser\IntlMoneyParser
 * Throws \MoneyOperation\Exceptions\InvalidOperationException when intl extension is not available
 */
$money = Operation::parse('$1.00', 'en_US') // Money::USD('100')
```

### To Decimal

[](#to-decimal)

```
use Money\Money;
use MoneyOperation\Operation;

/**
 * Uses \Money\Parser\DecimalMoneyFormatter
 */
$money = Operation::of(Money::EUR(54321))->toDecimal() // double(543.21)
```

### Factory

[](#factory)

```
use Money\Money;
use MoneyOperation\Operation;

/**
 * @param int|numeric-string $amount
 * @param Currency|non-empty-string $currency
 */
$money = Operation::factory(100, 'EUR') // Money::EUR('100')
```

Author
------

[](#author)

Created by [Roger Vilà](https://rogervila.es)

License
-------

[](#license)

MoneyPHP Operations is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

Icons made by [Prosymbols Premium](https://www.flaticon.es/autores/prosymbols-premium "Freepik") from [www.flaticon.es](https://www.flaticon.es/iconos-gratis/administracion-del-dinero "Flaticon")

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance58

Moderate activity, may be stable

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 63% 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 ~53 days

Recently: every ~62 days

Total

7

Last Release

897d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/351443b7d23e94fcf31b250db90f0b9578cc9fd8e0cefbed9666467e3e9cb571?d=identicon)[rogervila](/maintainers/rogervila)

---

Top Contributors

[![rogervila](https://avatars.githubusercontent.com/u/6053012?v=4)](https://github.com/rogervila "rogervila (17 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (10 commits)")

---

Tags

money operationsmoneyphp helpersmoney percentage

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/rogervila-moneyphp-operations/health.svg)

```
[![Health](https://phpackages.com/badges/rogervila-moneyphp-operations/health.svg)](https://phpackages.com/packages/rogervila-moneyphp-operations)
```

###  Alternatives

[cknow/laravel-money

Laravel Money

1.0k4.3M22](/packages/cknow-laravel-money)[verbb/formie

The most user-friendly forms plugin for Craft.

101372.9k40](/packages/verbb-formie)[vyuldashev/nova-money-field

A Laravel Nova field for Money.

73784.4k1](/packages/vyuldashev-nova-money-field)[leandrocfe/filament-ptbr-form-fields

Brazilian pt-BR form fields.

14398.7k](/packages/leandrocfe-filament-ptbr-form-fields)[pelmered/filament-money-field

94162.4k1](/packages/pelmered-filament-money-field)[serendipity_hq/component-value-objects

A set of value objects to manage simple and composite values

20558.6k4](/packages/serendipity-hq-component-value-objects)

PHPackages © 2026

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