phpuef/currency

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

Type:template

v1.1.0-rc1 2025-05-18 12:45 UTC

This package is auto-updated.

Last update: 2025-05-19 01:17:06 UTC


README

Currency

The currency package provides functionality to manage and validate different currency codes and their details. It contains a list of currency codes with information such as the name, symbol, and minor units (decimal places). You can use this package to retrieve currency information and validate whether a currency code exists. (ISO 4217)

Static Badge

Packagist Downloads GitHub stars PHPStan Tests codecov

Versions

Stable Version GitHub Release GitHub Release

Also available in other languages

Go Implementation PHP Implementation

Features

  • Search for a currency by its code (e.g., USD, EUR).
  • Validate if a currency code exists.
  • Return detailed information such as currency name, symbol, and minor units.

Installation

composer require gouef/currency

Usages

Finding a currency

You can use the FindCurrency function to search for a currency by its code. It returns a pointer to the Currency object, which contains details like the name, symbol, and minor units.

<?php

use Phpuef\Currency\Currencies;

class Example {

    public function get(string $code) {
        $currency = Currencies::FindCurrency($code);
        //
    }

}

Validating a Currency Code

To check whether a currency code is valid, use the ValidateCurrency function. It returns true if the code exists and false otherwise.

<?php

use Phpuef\Currency\Currencies;

class Example {

    public function validate(string $code): bool {
        return Currencies::ValidateCurrency($code);
    }

}

Contributing

Read Contributing

Contributors

JanGalek actions-user

Join our Discord Community! 🎉

Discord

Click above to join our community on Discord!