Skip to content

Custom short difinitions for currencies #42

@PostScripton

Description

@PostScripton

In Russian, we are used to write short definition of ruble like 100 руб., not symbol .
So I'd like to add this functionallity on config level and on built-in currency lists for customizing currencies from different countries.

A use-case may look like:

// config/money.php

return [
    // ...

    'primarily_use_custom_definitions' => true,
    'custom_definitions` => [
        'RUB' => 'руб.'
    ],
];
money(1000)->toString(); // "100 ₽"

money(1000)->withCustomDefinition()->toString(); // "100 руб."

money(1000)->settings()->useCustomDefinition(true)->toString(); // "100 руб."

If there's no custom definition in the config file for the currency, then it just ignores and intended symbol is used ( / RUB).

You can help me out with the method name in the comments below 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions