PHPackages                             soora-jp/knnc - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. soora-jp/knnc

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

soora-jp/knnc
=============

Convert Japanese-Kanji numerals string and numeric each other

1.0.2(6y ago)2119[4 issues](https://github.com/soora-jp/php-knnc/issues)BSD-2-ClausePHPPHP &gt;=5.4.0

Since Aug 19Pushed 2y ago1 watchersCompare

[ Source](https://github.com/soora-jp/php-knnc)[ Packagist](https://packagist.org/packages/soora-jp/knnc)[ Docs](https://github.com/soora-jp/php-knnc)[ RSS](/packages/soora-jp-knnc/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (3)DependenciesVersions (4)Used By (0)

Japanese-Kanji Numeral string and Numeric Converter (KNNC)
==========================================================

[](#japanese-kanji-numeral-string-and-numeric-converter-knnc)

Introduction
------------

[](#introduction)

This is a PHP library for converting between Japanese-Kanji numeral string and numeric (int or float).

Requirement
-----------

[](#requirement)

PHP 8.0 or later

Installation
------------

[](#installation)

Install this KNNC library using Composer.

```
composer require soora-jp/knnc
```

Getting started
---------------

[](#getting-started)

### Convert Japanese-Kanji numeral string to numeric

[](#convert-japanese-kanji-numeral-string-to-numeric)

```
SooraJP\KNNC::kan2num('一万二千三百四十五');
```

Result: 12345

### Convert umeric to Japanese-Kanji numeral string

[](#convert-umeric-to-japanese-kanji-numeral-string)

**ConvertType** General

```
SooraJP\KNNC::num2kan(123456789);
// "一億二三四五万六七八九"
```

**ConvertType** General Strict

```
SooraJP\KNNC::num2kan(123456789, SooraJP\KNNC\ConvertType::STRICT);
// "一億二千三百四十五万六千七百八十九"
```

**ConvertType** Complex

```
SooraJP\KNNC::num2kan(123456789, SooraJP\KNNC\ConvertType::COMPLEX);
// "壱億弐参四五万六七八九"
```

**ConvertType** Complex Strict

```
SooraJP\KNNC::num2kan(123456789, SooraJP\KNNC\ConvertType::COMPLEX | SooraJP\KNNC\ConvertType::STRICT);
// "壱億弐千参百四拾五萬六千七百八拾九"
```

Reference example
-----------------

[](#reference-example)

**kan2num()**
・「九千弐拾参」-&gt;「9023」
・「123百万」-&gt;「123000000」
・「1億1万」-&gt;「100010000」
・「1万1億」-&gt;「false」
・「1万1234」-&gt;「12345」
・「1万12345」-&gt;「false」

Specification like a bug
------------------------

[](#specification-like-a-bug)

**kan2num()**
・「二十万12345」-&gt;「212345」

To be changed in the future
---------------------------

[](#to-be-changed-in-the-future)

・kan2num: If there is a character such as a "円" at the end, ignore it without returning false.
・num2kan: Make it possible to omit "一" of "一千".

LICENSE
-------

[](#license)

```
BSD 2-Clause License

Copyright (c) 2019, Soora JP
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
```

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

2506d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/28481373?v=4)[Sora](/maintainers/soora-jp)[@soora-jp](https://github.com/soora-jp)

---

Top Contributors

[![soora-jp](https://avatars.githubusercontent.com/u/28481373?v=4)](https://github.com/soora-jp "soora-jp (12 commits)")

---

Tags

convertstringjapanesenumericNumeralskanji

### Embed Badge

![Health badge](/badges/soora-jp-knnc/health.svg)

```
[![Health](https://phpackages.com/badges/soora-jp-knnc/health.svg)](https://phpackages.com/packages/soora-jp-knnc)
```

###  Alternatives

[nette/utils

🛠 Nette Utils: lightweight utilities for string &amp; array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.

2.1k417.9M1.7k](/packages/nette-utils)[kwn/number-to-words

Multi language standalone PHP number to words converter. Fully tested, open for extensions and new languages.

4285.3M23](/packages/kwn-number-to-words)[coduo/php-to-string

Simple library that converts PHP value into strings

26913.1M13](/packages/coduo-php-to-string)[opis/string

Multibyte strings as objects

7424.5M8](/packages/opis-string)[icecave/repr

A library for generating string representations of any value, inspired by Python's reprlib library.

277.5M4](/packages/icecave-repr)[phootwork/lang

Missing PHP language constructs

1227.1M8](/packages/phootwork-lang)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
