Money
PHP implementation of Fowler's Money pattern. (by moneyphp)
Safe
All PHP functions, rewritten to throw exceptions instead of returning false (by thecodingmachine)
Money | Safe | |
---|---|---|
18 | 7 | |
4,538 | 2,306 | |
0.7% | 0.4% | |
7.8 | 0.0 | |
3 months ago | 5 days ago | |
PHP | PHP | |
MIT License | MIT License |
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Money
Posts with mentions or reviews of Money.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2023-10-18.
-
PHP libraries and tools
moneyphp: PHP implementation of Fowler's Money pattern
-
PHP is trolling me
There's also https://github.com/moneyphp/money, which is great.
-
Why should you not compare floats directly for equality?
Or you can use MoneyPHP, which uses BCMath, and it takes care of all of your problems.
-
Library for discounts calculator
Instead, you want to use a Money object of some sort instead; e.g. https://github.com/moneyphp/money.
-
Should I store the total price of an order or re-calculate it on-demand every time?
Yeah I usually use moneyphp for this
-
Need Guidance for my Passionate Ecommerce Project
https://github.com/moneyphp/money to handle money
-
A GitHub Workflow to Check the Compatibility of Your PHP Package with a Range of Dependency Versions
With that in place, let's talk about our test project for a minute. We are going to build a small library on top of Money, a popular PHP package facilitating the manipulation of monetary values and currencies.
-
Need help with decimal and float type in Laravel API.
In addition to the essential advice above to use Integers of the lowest denomination to store prices, you can also look into using a library to help with all the money math, conversions, comparisons etc https://github.com/moneyphp/money
-
Financial values in PHP
Read the readme from moneyphp: https://github.com/moneyphp/money
- Best way to handle PHP float issue
Safe
Posts with mentions or reviews of Safe.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2023-10-18.
-
PHP libraries and tools
thecodingmachine/safe: All PHP functions, rewritten to throw exceptions instead of returning false
-
Oh boy here we go again…
There are workarounds with some third party libraries, but yeah, it's a pain.
- Which inconsistences of PHP annoy you the most?
-
Any ideas about why json_encode would return empty for a request on local dev, but not empty on server?
- try not to use the built-in json_encode, as it doesnt have proper error handling. Use instead this: https://github.com/thecodingmachine/safe and Safe\json_encode()
-
Native defer & errdefer
Not what you asked for, in modern codebases it's advised to use things like https://github.com/thecodingmachine/safe
-
Use namespaced functions to replace native functions - github.com/rezen/proxyz
The goal of https://github.com/thecodingmachine/safe is different than proxyz. My goal is a method proxy that allows you to override or watch the behaviour of a function from the "global namespace" effortlessly.
-
preg_last_error() and json_last_error()
Safe-PHP redeclares all core PHP functions (in a new namespace) to throw exceptions properly. I use this on almost every project now.
What are some alternatives?
When comparing Money and Safe you can also consider the following projects:
Brick\Money - A money and currency library for PHP
PHP Dotenv - Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.
OmniPay - A framework agnostic, multi-gateway payment processing library for PHP 5.6+
Symfony VarDumper - Provides mechanisms for walking through any arbitrary PHP variable
laravel-money - Currency formatting and conversion package for Laravel
Expose - A beautiful, fully open-source, tunneling service - written in pure PHP
Sebastian Money
phpstan-safe-rule - A PHPStan rule to be used with the thecodingmachine/safe package
biller
Symfony Dotenv - Registers environment variables from a .env file
Shopware - Shopware 5 core
Yo! Symfony TOML - A PHP parser for TOML