Download the PHP package doefom/currency-fieldtype without Composer

On this page you can find all versions of the php package doefom/currency-fieldtype. 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 currency-fieldtype

Currency Fieldtype

Currency Fieldtype is a Statamic addon that lets you handle any currency with ease by utilizing an input mask. Well, not any, but many at least. 25 of the world's most traded ones to be precise. See which currencies we currently support.

Supported Versions

Features

The addon makes sure you always get the right format depending on the locale and currency that's being used. While you can safely ignore the addon when using it, it still provides useful information in the background in case you need it. Here's the information you'll get:

Input Mask

The fieldtype implements a mask on the input field for each individual currency which provides a very smooth experience when handling financial data or currencies.

How to Install

You can search for this addon in the Tools > Addons section of the Statamic control panel and click install, or run the following command from your project root:

How to Use

Field Configuration

You can add the fieldtype to your blueprints like you would any other fieldtype that is already part of Statamic. For configuration, you simply need to select which currency you would like to use, and you're good to go. In addition, you can enable sub-unit storage for the field's value.

Configuration Option Description Default
Currency The currency you want to use for the field. 'USD'
Sub-Units Store value in the currency's smallest sub-unit. false
Default Value Set a default value. null

Usage in Antlers Templates

To give you all the flexibility and information you need the fieldtype supports augmentation so many more values are available than just the plain value. Let's say we have a blueprint that uses the currency fieldtype with the field handle price. After saving a value to an entry, this is what your data would look like:

When using the field in an Antlers template, you have access to the following information:

The same is true when using the Statamic API or in any other situation where the retrieved data is augmented. When using sub-unit value storage, the formatted values will be in the primary unit, while value is returned directly, in sub-units. In the example above, with sub-unit storage enabled, the first three values would consist of the following:

Caveats

Changing the currency fieldtype's configuration after using it

If you've configured your currency fieldtype to use a specific currency, then save a bunch of entries with it and then change its configuration, in most cases this won't cause any problems. The data will just be converted to the newly configured currency. However, some currency conversion might cause issues and this is especially the case, when the currency you convert into has fewer decimal digits than the one you started with.

For example: Let's say we have an entry with a price (the field uses the Currency Fieldtype) of 1234.56. In USD (US Dollar) this will be displayed as $1,234.56. If you then convert to JPY (Japanese Yen) which has 0 decimal digits, you'll get a wrong result of ¥1,235. That's just something to keep in mind in case you'd need to reconfigure the field.

Exchange rates

If you change the currency in the field configuration we just use another format, that's it. We do not convert any currency into another.

Supported Currencies

Your currency is missing? Feel free to submit a GitHub issue, we're happy to add yours as well!

Support

This addon is under active maintenance. If something doesn't go as planned, or you see an opportunity to improve, just open up a GitHub issue, and we'll do our best to take your request into account.


All versions of currency-fieldtype with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
statamic/cms Version ^v4.0|^v5.0
ext-intl Version *
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 doefom/currency-fieldtype contains the following files

Loading the files please wait ...