karyasystem/rupiah-helper

An advanced and flexible Rupiah Currency Helper for Laravel. Provides functions for formatting numbers into Rupiah format (IntToRupiah), converting Rupiah format back to integers (RupiahToInt), and converting numbers to Indonesian text (Terbilang). Includes extensive options to customize the currenc

1.0.1 2024-12-12 15:19 UTC

This package is auto-updated.

Last update: 2025-06-13 03:06:43 UTC


README

An advanced and flexible Rupiah Currency Helper for Laravel. This package provides functions to format numbers into Rupiah format (IntToRupiah), convert Rupiah format back to integers (RupiahToInt), and convert numbers to Indonesian text (Terbilang). It includes extensive options to customize the currency format to suit your needs, making it a powerful tool for handling Rupiah in Laravel applications.

Features

  • IntToRupiah: Format integers into Rupiah currency (IDR or Rp) with customizable options.
  • RupiahToInt: Convert Rupiah-formatted strings back to integers.
  • Terbilang: Convert numbers to Indonesian text representation (terbilang).

Installation

To install the package, run the following command in your Laravel project:

  composer require karyasystem/rupiah-helper

Usage

IntToRupiah

Use this function to format an integer into Rupiah currency format

use Rupiah;

$formattedRupiah = Rupiah::IntToRupiah(1000000, 'Rp'); // Rp 1,000,000
$formattedRupiah = Rupiah::IntToRupiah(1000000); // IDR 1,000,000 (default is 'IDR')

options

  • currency: (optional) 'Rp' or 'IDR' (default is 'Rp')
  • format: (optional) Choose to display thousands separator, decimal point, etc.

RupiahToInt

Use this function to convert a Rupiah-formatted string back to an integer.

$intValue = Rupiah::RupiahToInt('Rp 1,000,000'); // 1000000

Terbilang

Use this function to convert numbers into their Indonesian text representation.

$text = Rupiah::Terbilang(1234567); // "Satu juta dua ratus tiga puluh empat ribu lima ratus enam puluh tujuh"

Contributing

Contributions are always welcome!

See contributing.md for ways to get started.

Please adhere to this project's code of conduct.

License

This package is open-source and available under the MIT License.