Search by

sanmai / japanese-numerals

sanmai

Library to convert Japanese numeral to their Western variants (AKA Hindu-Arabic numerals)

Package info

github.com/sanmai/JapaneseNumeral

pkg:composer/sanmai/japanese-numerals

Statistics

Installs: 19 374

Dependents: 0

Suggesters: 0

Stars: 2

Open Issues: 2

v0.1.5 2026-11-18 00:25 UTC

This package is auto-updated.

Last update: 2026-11-18 00:26:43 UTC


README

Build Status Coverage Status Latest Stable Version License

JapaneseNumeral

Library to convert Japanese numeral to their Western variants (AKA Hindu-Arabic numerals)

Installation is simple:

composer require sanmai/japanese-numerals

Usage

To convert a number from Hindu-Arabic numerals to Japanese numerals, use:

$japanese = \JapaneseNumerals\JapaneseNumerals::fromArabicToJapanese(123);
var_dump($japanese);

Should output:

string(12) "百二十三"

To convert a string of Japanese numerals to Hindu-Arabic numerals, use:

$arabic = \JapaneseNumerals\JapaneseNumerals::fromJapaneseToArabic('二千二十五');
var_dump($arabic);

Should output:

string(4) "2025"

Acknowledgements

Special thanks go to Navarr Barnier (@navarr) for the initial implementation of the algorithm.