Laravel Money

Laravel Money

Laravel Money is a composer package by Ricardo Gobbo de Souza for working with and formatting money in Laravel projects.

Laravel money uses the moneyphp/money PHP package under the hood and gives you a bunch of helpers:

use Cknow\Money\Money;

echo Money::USD(500); // $5.00

This package includes a ton of advanced features for doing money operations, comparisons, aggregations, formatting, and parsing:

// Basic operations
Money::USD(500)->add(Money::USD(500)); // $10.00
Money::USD(500)->subtract(Money::USD(400)); // $1.00

// Aggregation
Money::min(Money::USD(100), Money::USD(200), Money::USD(300)); // Money::USD(100)

// Formatters
Money::USD(500)->format(); // $5.00

// Parsers
Money::parse('$1.00'); // Money::USD(100)

You can also create a custom formatter for your specific use-case:

Money::USD(500)->formatByFormatter(new MyFormatter());

Be sure to check out the advanced usage and included helper functions in the project’s README file. Also, check out the Money PHP documentation for complete details of what this package is capable of doing.

You can learn more about this package and check out the source code on GitHub at cknow/laravel-money.


Filed in: News / packages


Newsletter

Join the weekly newsletter and never miss out on new tips, tutorials, and more.

Laravel News Partners

Laravel Jobs

Software Engineer Lead (PHP)
Remote
CivicPlus, LLC
Full-time Senior Web Developer
Detroit, MI
Wayne State University
Senior Software Engineer
Sydney, Australia
FoodByUs
Full Stack Engineer
Remote or Medford, Oregon
Empire Medical
Laravel Developer (fulltime - Dutch only)
Netherlands
Qbixx | Webservices
Full Stack or Back-End Developer
Alexandria, VA; Tallahassee, FL; Orlando, FL
Marketing for Change
Senior Quality Assurance Engineer
Remote
Bisnow Media