PHPackages                             rebib/phonenumbersplitter - 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. rebib/phonenumbersplitter

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

rebib/phonenumbersplitter
=========================

ハイフン無しの電話番号をハイフン付の形式に変換する

1.3.0(6y ago)118.0k↓64.2%2mitPHPPHP ^7.2CI failing

Since Oct 28Pushed 6y ago2 watchersCompare

[ Source](https://github.com/rebib/phonenumbersplitter)[ Packagist](https://packagist.org/packages/rebib/phonenumbersplitter)[ RSS](/packages/rebib-phonenumbersplitter/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (5)Dependencies (2)Versions (8)Used By (0)

Phone number splitter
=====================

[](#phone-number-splitter)

日本の電話番号を、ハイフン区切りの表記へ整形するためのライブラリです。

- 電話番号を「市外局番-市内局番-識別番号」に分割
- ハイフン無しの電話番号をハイフン付の形式に変換
- ハイフン付の電話番号をハイフン無しの形式に変換
- 緊急通報番号や携帯電話番号も含めて整形

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

[](#installation)

You can install this plugin with Composer. Requires PHP 8.4.1+.

```
composer require rebib/phonenumbersplitter
```

Usage
-----

[](#usage)

### 基本的な使い方

[](#基本的な使い方)

```
use Rebib\Phonenumber\Splitter;

$provider = (new Splitter())->parse('0312345678');
```

### ハイフン付きで取得する

[](#ハイフン付きで取得する)

```
echo $provider->getNumberWithHyphen();
```

```
03-1234-5678

```

### ハイフン無しで取得する

[](#ハイフン無しで取得する)

```
echo $provider->getNumberWithoutHyphen();
```

```
0312345678

```

### 配列で取得する

[](#配列で取得する)

```
print_r($provider->toArray());
```

```
Array
(
    [0] => 03
    [1] => 1234
    [2] => 5678
)

```

Usage examples
--------------

[](#usage-examples)

```
use Rebib\Phonenumber\Splitter;

$splitter = new Splitter();

echo $splitter->parse('110')->getNumberWithHyphen();
// 110

echo $splitter->parse('157')->getNumberWithHyphen();
// 157

echo $splitter->parse('05078273831')->getNumberWithHyphen();
// 050-7827-3831

echo $splitter->parse('08012345678')->getNumberWithHyphen();
// 080-1234-5678

echo $splitter->parse('031-234-5678')->getNumberWithHyphen();
// 03-1234-5678
```

Inspired by kennyj's article on splitting Japanese phone numbers.

Reference
---------

[](#reference)

- 総務省 [電気通信番号指定状況](https://www.soumu.go.jp/main_sosiki/joho_tsusin/top/tel_number/number_shitei.html)

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

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 ~4 days

Total

7

Last Release

2417d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/068eee7be2ce6caa6a52aff1e8b20e9d347fa62b0dfd6343d7292285770b10dc?d=identicon)[rebib](/maintainers/rebib)

---

Top Contributors

[![zhao-xinyou](https://avatars.githubusercontent.com/u/4452790?v=4)](https://github.com/zhao-xinyou "zhao-xinyou (15 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rebib-phonenumbersplitter/health.svg)

```
[![Health](https://phpackages.com/badges/rebib-phonenumbersplitter/health.svg)](https://phpackages.com/packages/rebib-phonenumbersplitter)
```

###  Alternatives

[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

103519.9k53](/packages/friendsoftypo3-content-blocks)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1189.8k](/packages/rcsofttech-audit-trail-bundle)[blackfire/player

A powerful web crawler and web scraper with Blackfire support

49617.1k](/packages/blackfire-player)[altis/local-server

Local Server module for Altis

18221.6k3](/packages/altis-local-server)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1616.4k14](/packages/2lenet-crudit-bundle)

PHPackages © 2026

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