PHPackages                             sineld/money - 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. sineld/money

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

sineld/money
============

Simple yet useful money operations for php.

144881PHP

Since May 21Pushed 7y ago3 watchersCompare

[ Source](https://github.com/sineld/money)[ Packagist](https://packagist.org/packages/sineld/money)[ RSS](/packages/sineld-money/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)DependenciesVersions (1)Used By (0)

sineld/money
============

[](#sineldmoney)

[![Latest Version](https://camo.githubusercontent.com/1148a38de330d9c75d32998f43ddcac288e0525c8d02d27f7e034ce5c12030d0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73696e656c642f6d6f6e65792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sineld/money)[![Total Downloads](https://camo.githubusercontent.com/0e396cdc32187cd5b2fb809577cd7baf057f1bdfda90f79bc75ae6192b9b66e8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73696e656c642f6d6f6e65792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sineld/money)

`sineld/money` is a PHP library to make working with money easier! No static properties or methods!

Any number you have passed to the class will automatically prepared to make math operations. Class uses `,` for thousands and `.` for decimals.

Package can be used with any framework or spagetty application. Just mail me if anything goes wrong.

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

[](#installation)

Via Composer

```
$ composer require sineld/money
```

Add usecase to the top of your file

```
use Sineld\Money\Money;
```

Start using.

Non-Composer Users
------------------

[](#non-composer-users)

Simply copy Money.php in src folder to your project and begin using. No extra dependencies.

### Request method aliases

[](#request-method-aliases)

For parametres to use with methods.

##### money-&gt;setDecimals(default = 2)

[](#money-setdecimalsdefault--2)

##### money-&gt;addTax(default = 18)

[](#money-addtaxdefault--18)

##### money-&gt;removeTax(default = 18)

[](#money-removetaxdefault--18)

##### money-&gt;setLocaleActive(default = false)

[](#money-setlocaleactivedefault--false)

##### money-&gt;setLocaleCode(default = TRL)

[](#money-setlocalecodedefault--trl)

##### money-&gt;setLocalePosition(default = prefix, (use "suffix" instead of reverse))

[](#money-setlocalepositiondefault--prefix-use-suffix-instead-of-reverse)

Usage Examples
--------------

[](#usage-examples)

All in one place:

```
make($number1) // Create a new Money instance.
    ->setDecimals(4) // Set decimals size.
    ->sum($number2) // Add $number2 variable(s) value to the $money
    ->subtract($number2) // Remove $number2 variable(s) value from the $money
    ->multiply('3') // Multiply $money with $numbers variable(s) value.
    ->divide('3') // Divide $money with $numbers variable(s) value.
    ->addTax(18) // Add $percent variable to the $money with calculated value.
    ->removeTax(18) // Remove $percent variable to the $money with calculated value.
    ->setLocaleActive(true) // Enable Locale Usage.
    ->setLocaleCode('₺ ') // Set Locale Code preference
    ->setLocalePosition('prefix') // Set Locale Position preference

    // ->getTax(); // Return calculated $taxAmount variable.
    ->get(); // Return $money variable according to the locale usage.
    // ->all(); // Return the $money and $taxAmount variables in a array.

var_dump($money);
```

Basic Sum Operation:

```
make($number1)
    ->sum($number2)
    ->get();

echo $money;
```

Basic Sum Operation with Two numbers:

```
make($number1)
    ->setDecimals(4)
    ->sum($number2, $number3)
    // ->sum($number2, $number3, $number4, ...) // add parametres as much as you need
    ->get();

echo $money;
```

Basic Subtract Operation:

```
make($number1)
    ->subtract($number2)
    ->get();

echo $money;
```

Basic Subtract Operation with Two numbers:

```
make($number1)
    ->setDecimals(4)
    ->subtract($number2, $number3)
    // ->subtract($number2, $number3, $number4, ...) // add parametres as much as you need
    ->get();

echo $money;
```

Basic Sum and Subtract Operations in one place:

```
make($number1)
    ->setDecimals(4)
    ->sum($number2)
    ->subtract($number3)
    ->get();

echo $money;
```

Basic Multiplication and Division Operations in one place:

```
make($number1)
    ->setDecimals(0)
    ->multiply($number2)
    ->divide($number3)
    ->get();

echo $money;
```

Basic Tax Operations:

```
make($number1)
    ->setDecimals(2)
    ->addTax($taxPercent)
    ->get();

// tax added number
echo $money;

$tax = (new Money())
    ->make($number1)
    ->setDecimals(2)
    ->addTax($taxPercent)
    ->getTax();

// calculated tax after addtition
echo $tax;

$money = (new Money())
    ->make($number1)
    ->setDecimals(2)
    ->addTax($taxPercent)
    ->all();

// tax added number and calculated tax together
// var_dump($money);
echo $money['amount'];
echo $money['tax'];
```

Remove tax percent from money:

```
make($number1)
    ->setDecimals(2)
    ->removeTax($taxPercent)
    ->get();

echo $money;
```

Remove tax percent from money and add new tax:

```
make($number1)
    ->setDecimals(2)
    ->removeTax($taxPercent1rst)
    ->addTax($taxPercent2nd)
    ->get();

echo $money;
```

Enable Locale String Output in the Prefix:

```
make($number1) // Create a new Money instance.
    ->setDecimals(4) // Set decimals size.
    ->setLocaleActive(true) // Enable Locale Usage.
    ->setLocaleCode('₺ ') // Set Locale Code preference
    ->setLocalePosition('prefix') // Set Locale Position preference

    ->get(); // Return $money variable according to the locale usage.

echo $money;
```

Enable Locale String Output in the Suffix:

```
make($number1) // Create a new Money instance.
    ->setDecimals(4) // Set decimals size.
    ->setLocaleActive(true) // Enable Locale Usage.
    ->setLocaleCode(' €') // Set Locale Code preference
    ->setLocalePosition('suffix') // Set Locale Position preference

    ->get(); // Return $money variable according to the locale usage.

echo $money;
```

Contributing
------------

[](#contributing)

Please see [contributing.md](contributing.md) for details and a todolist.

Security
--------

[](#security)

If you discover any security related issues, please email author email instead of using the issue tracker.

Credits
-------

[](#credits)

- [Sinan Eldem](https://www.sinaneldem.com.tr)

License
-------

[](#license)

Please see the [license file](license.md) for more information.

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity37

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/445349?v=4)[Sinan Eldem](/maintainers/sineld)[@sineld](https://github.com/sineld)

---

Top Contributors

[![sineld](https://avatars.githubusercontent.com/u/445349?v=4)](https://github.com/sineld "sineld (2 commits)")

### Embed Badge

![Health badge](/badges/sineld-money/health.svg)

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

###  Alternatives

[darkghosthunter/preloader

Preloader helper to create a PHP-ready preload script from Opcache.

434681.7k1](/packages/darkghosthunter-preloader)[robertboes/inertia-breadcrumbs

Laravel package to automatically share breadcrumbs to Inertia

59150.6k1](/packages/robertboes-inertia-breadcrumbs)[openpsa/universalfeedcreator

RSS and Atom feed generator by Kai Blankenhorn

3595.5k1](/packages/openpsa-universalfeedcreator)[tuandm/geoip2

Extended MaxMind GeoIP2 PHP API

118.5k](/packages/tuandm-geoip2)

PHPackages © 2026

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