Download the PHP package origami/money without Composer

On this page you can find all versions of the php package origami/money. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package money

Origami Money for Laravel

This package is a money helper for Laravel projects and a wrapper around moneyphp/money.

Installation

Install this package through Composer.

Requirements

Configuration

First, publish the default configuration.

This will add a new configuration file to: config/money.php which contains a default_currency value.

Usage

Value Object

The Origami\Money\Money value object class is a helper that uses a Money\Money object (from moneyphp/money) under the hood. This allows us to add some helper methods (e.g. for formatting) and be more opinionated about our implementation. The class does not extend Money\Money since that is a final class - instead we use an internal attribute.

As with Money\Money, each Origami\Money\Money object requires an:

For example:

You can also pass a moneyphp object:

Available Methods

instance

Create an instance from Money\Money object:

copy

Create a copy of the instance

asBase

Get the underlying Money\Money object

isSameCurrency

equals

greaterThan / gt

greaterThanOrEqual / gte

lessThan / lt

lessThanOrEqual / lte

isZero

isPositive

isNegative

percentageOf

Set $overflow argument to false to not go over 100

getAmount

Returns integer

getCurrency

Returns Money\Money currency value object

getCurrencyCode

add

subtract

multiply

divide

mod

Modulus operation

ratioOf

Provides the ratio of a Money object compared to another

absolute

negative

Formatting

String

Uses Intl formatter for currency symbol and separatator.

String Neat (without Trailing Zeros)

Only drops trailing zeros were decimal is zero.

Decimal

Blade Directives

You can use the following directives in your Blade views:

Eloquent Attribute Cast

You are most likely storing your money values in your Eloquent models. This package provides an Origami\Money\Casts\Money custom Laravel cast for you to use:

In the example above, you can set the total attributes using a Money object:

In the example above, $invoice->total will be an instance of:

You can also use a float, string or integer value when setting the casted attribute - for example from a controller.

Important: This will use the Origami\Money\MoneyHelper@input method behind the scenes (which ultimately uses Origami\Money\MoneyHelper@adjustAmount), transforming the amount to the smallest unit of currency after assuming it is given as dollars or pounds, for example.

Your model should have a currency attribute or a getCurrencyCode method with / which returns the ISO-4217 code. Otherwise, this package will default to the default_currency set in the config file.

The above therefore converts to:

If your controllers or other methods already expect user input in cents rather than dollars, you should either not use the cast or instead pass an Origami\Money\Money object instead of the numerical amount (which would be tranformed).

Versions

Author

License

View the license


All versions of money with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
ext-intl Version *
illuminate/contracts Version ^8.0|^9.0|^10.0|^11.0
illuminate/support Version ^8.0|^9.0|^10.0|^11.0
moneyphp/money Version ^3.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package origami/money contains the following files

Loading the files please wait ....