PHPackages                             denshoch/harusame - 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. denshoch/harusame

ActiveLibrary

denshoch/harusame
=================

Add special HTML classes for Tate-Chu-Yoko and text-orientaion.

2.2.0(1y ago)0828↓100%[1 issues](https://github.com/denshoch/harusame/issues)MITPHPPHP &gt;=7.4 || ^8.0

Since Aug 19Pushed 1y ago2 watchersCompare

[ Source](https://github.com/denshoch/harusame)[ Packagist](https://packagist.org/packages/denshoch/harusame)[ Docs](https://github.com/denshoch/harusame)[ RSS](/packages/denshoch-harusame/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (19)Used By (0)

Harusame
========

[](#harusame)

Harusame is a library designed to control the orientation of characters in vertical writing. It allows for the proper display of text in Japanese vertical format, ensuring that characters are displayed upright or sideways as needed. This is particularly useful for applications that require text to be formatted according to traditional Japanese typesetting standards.

Wrap sequence of numbers (default is two-digit) and sequence of EXCLAMATION (QUESTION) MARKs with `span.tcy` in (see [Tate-Chu-Yoko](https://www.w3.org/TR/jlreq/#handling_of_tatechuyoko)).

Wrap each character of upright glyph orientation with `span.upright` and sideways glyph orientation with `span.sideways` (see [UTR50](http://www.unicode.org/reports/tr50/)).

Expected CSS;

```
.tcy {
    text-combine-upright: all;
}
.upright {
    text-orientation: upright;
}
.sideways {
    text-orientation: sideways;
}
```

Install
-------

[](#install)

```
composer install

```

Usage
-----

[](#usage)

New static method `transformText`

```
$result = Denshoch\Harusame::transformText('平成20年!?');
// => 平成20年!?

// With options
$options = ['tcyDigit' => 3];
$result = Denshoch\Harusame::transformText('10円玉と100円玉がある。', $options);
// => 10円玉と100円玉がある。
```

Previous usage

```
$harusame = new Denshoch\Harusame();
$harusame->transform('平成20年!?');
// => 平成20年!?

$harusame->transform('平成20年!?平成20年!?');
// You can pass HTML string. Only text nodes within the body tag are transformed.
// => 平成20年!?平成20年!?

$harusame->transform('⓵☂÷∴');
// => ⓵☂÷∴
```

### Options

[](#options)

```
$options = array("tcyDigit" => 3);
$harusame = new Denshoch\Harusame($options);
$harusame->transform('10円玉と100円玉がある。');
// => 10円玉と100円玉がある。
// or
$harusame = new Denshoch\Harusame();
$harusame->tcyDigit = 3;
$harusame->transform('10円玉と100円玉がある。');
// => 10円玉と100円玉がある。
```

KeyTypeInitialDescriptiontcyDigitinteger2Maximum number of digits to add `.tcy` class. If set to 0, no `.tcy` class will be added.autoTextOrientationbooleantrueAdd `.upright` and `.sideways` class or not.Error Handling
--------------

[](#error-handling)

When invalid XML is provided as input, the `transform` method will return the original text instead of throwing an exception. Additionally, an error message will be logged to indicate that invalid XML was encountered. This allows for graceful handling of errors while still providing feedback about the issue.

Test
----

[](#test)

```
$ vendor/bin/phpunit

```

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity77

Established project with proven stability

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

Recently: every ~389 days

Total

16

Last Release

533d ago

Major Versions

1.0.5 → 2.0.02020-02-20

PHP version history (2 changes)2.1.4PHP &gt;=7.2

2.2.0PHP &gt;=7.4 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/300c27810659995976cf7fc8cb82e3c2a5e244c24dab6c4eecc8052272234569?d=identicon)[denshoch](/maintainers/denshoch)

---

Top Contributors

[![lostandfound](https://avatars.githubusercontent.com/u/596183?v=4)](https://github.com/lostandfound "lostandfound (66 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/denshoch-harusame/health.svg)

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

PHPackages © 2026

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