PHPackages                             yajima-tatsuro/jp-yen-formatter - 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. yajima-tatsuro/jp-yen-formatter

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

yajima-tatsuro/jp-yen-formatter
===============================

日本円の数値を「千円」「万円」などの単位に変換・フォーマットするPHPパッケージ

v1.0.0(5mo ago)00MITPHPPHP ^8.0CI passing

Since Dec 3Pushed 5mo agoCompare

[ Source](https://github.com/Tatsurou-Yajima/jp-yen-formatter)[ Packagist](https://packagist.org/packages/yajima-tatsuro/jp-yen-formatter)[ Docs](https://github.com/Tatsurou-Yajima/jp-yen-formatter)[ RSS](/packages/yajima-tatsuro-jp-yen-formatter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

JP Yen Formatter
================

[](#jp-yen-formatter)

日本円の数値を「千円」「万円」「億円」などの読みやすい単位に変換・フォーマットするPHPパッケージです。

> **Note for English speakers**: This package is designed for Japanese native speakers, so the README is written in Japanese. If you need English documentation, please use browser translation features or other translation tools.

インストール
------

[](#インストール)

```
composer require yajima-tatsuro/jp-yen-formatter
```

使い方
---

[](#使い方)

```
use JpYenFormatter\Converter;

// 千単位への変換
echo Converter::convert(1000, '千');  // "1千"
echo Converter::convert(1500, '千');  // "1.5千" (割り切れない場合は自動で小数点第一位まで)

// 万単位への変換
echo Converter::convert(10000, '万'); // "1万"
echo Converter::convert(15000, '万'); // "1.5万"

// 百万単位への変換
echo Converter::convert(1000000, '百万'); // "1百万"
echo Converter::convert(1500000, '百万'); // "1.5百万"

// 億単位への変換
echo Converter::convert(100000000, '億'); // "1億"
echo Converter::convert(150000000, '億'); // "1.5億"
```

### 使用例

[](#使用例)

```
use JpYenFormatter\Converter;

// 基本的な変換
$result = Converter::convert(5000, '千');
// 結果: "5千"

$result = Converter::convert(50000, '万');
// 結果: "5万"

// 割り切れない場合（デフォルトで小数点第一位まで表示）
$result = Converter::convert(1500, '千');
// 結果: "1.5千"

$result = Converter::convert(23000, '万');
// 結果: "2.3万"

// 小数点桁数を指定
$result = Converter::convert(12340, '千', 2);
// 結果: "12.34千"

$result = Converter::convert(123400, '万', 3);
// 結果: "12.34万"

// 大きな数値の自動フォーマット（カンマ区切り）
$result = Converter::convert(100000000000, '億');
// 結果: "1,000億"

$result = Converter::convert(100000000, '万');
// 結果: "10,000万"

// 未定義の単位を指定した場合
$result = Converter::convert(1000, '円');
// 結果: "1000円"
```

### 対応している単位

[](#対応している単位)

以下の単位に対応しています：

- **千**: 1,000単位
- **万**: 10,000単位
- **百万**: 1,000,000単位
- **億**: 100,000,000単位

### 小数点表示の動作

[](#小数点表示の動作)

デフォルトでは、割り切れる場合は整数表示、割り切れない場合は小数点第一位まで自動表示されます：

```
// 割り切れる場合
echo Converter::convert(2000, '千');  // "2千"
echo Converter::convert(30000, '万'); // "3万"

// 割り切れない場合
echo Converter::convert(1500, '千');  // "1.5千"
echo Converter::convert(23000, '万'); // "2.3万"
```

小数点桁数を手動で指定することも可能です：

```
// 小数点第二位まで表示
echo Converter::convert(12340, '千', 2);  // "12.34千"

// 小数点なし（整数のみ）
echo Converter::convert(1500, '千', 0);   // "2千" (四捨五入)
```

テスト
---

[](#テスト)

```
composer test
```

ライセンス
-----

[](#ライセンス)

MIT License

開発者
---

[](#開発者)

yajima-tatsuro

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance72

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity40

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

Unknown

Total

1

Last Release

160d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/194191010cb4559eb0b5476db5a4a848f00cb1510c643e1bf521028df6fce72b?d=identicon)[Tatsuro Yajima](/maintainers/Tatsuro%20Yajima)

---

Top Contributors

[![Tatsurou-Yajima](https://avatars.githubusercontent.com/u/44424270?v=4)](https://github.com/Tatsurou-Yajima "Tatsurou-Yajima (3 commits)")

---

Tags

phpformattermoneycurrencyjapankanjiyen

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/yajima-tatsuro-jp-yen-formatter/health.svg)

```
[![Health](https://phpackages.com/badges/yajima-tatsuro-jp-yen-formatter/health.svg)](https://phpackages.com/packages/yajima-tatsuro-jp-yen-formatter)
```

###  Alternatives

[kwn/number-to-words

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

4235.0M21](/packages/kwn-number-to-words)[ikr/money-math

gmp-based arbitrary precision operations on currency amounts "XXX.YY"; because floats are BAD for representing money

3115.0k1](/packages/ikr-money-math)

PHPackages © 2026

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