PHPackages                             revolution/laravel-str-mixins - 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. revolution/laravel-str-mixins

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

revolution/laravel-str-mixins
=============================

Laravel Str mixins

2.8.0(2mo ago)223.6k—8.6%MITPHPPHP ^8.3CI passing

Since Oct 1Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/invokable/laravel-str-mixins)[ Packagist](https://packagist.org/packages/revolution/laravel-str-mixins)[ GitHub Sponsors](https://github.com/invokable)[ RSS](/packages/revolution-laravel-str-mixins/feed)WikiDiscussions main Synced 1mo ago

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

Laravel Str mixins
==================

[](#laravel-str-mixins)

Mixin that extends `Illuminate\Support\Str` mainly for Japanese language use

Requirements
------------

[](#requirements)

- PHP &gt;= 8.3
- Laravel &gt;= 12.0

Versioning
----------

[](#versioning)

verPHPLaravel[1.x](https://github.com/invokable/laravel-str-mixins/tree/1.x)^7.262.x^8.3^12- v1.x is for Laravel 6 only.
- v2.x supports Laravel 7 and above only for Fluent Strings.

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

[](#installation)

```
composer require revolution/laravel-str-mixins
```

### Uninstall

[](#uninstall)

```
composer remove revolution/laravel-str-mixins
```

Str
---

[](#str)

### Str::textwrap(string $str, int $width = 10, string $break = PHP\_EOL): string

[](#strtextwrapstring-str-int-width--10-string-break--php_eol-string)

Line breaks at specified number of characters. Simple line breaks without word-wrapping rules.

```
$text = Str::textwrap(str: 'abcde', width: 3);

// abc
// de
```

Originally intended for forcing line breaks to fit within OGP image width.

Changed to `textwrap` because Laravel 10.19.0 added a function with the same name `Str::wordWrap()`. Kept instead of removing because the behavior is different. `Str::wordWrap()` doesn't work as expected with Japanese text.

### Str::kana(string $str, string $option = 'KV', string $encoding = 'UTF-8'): string

[](#strkanastring-str-string-option--kv-string-encoding--utf-8-string)

Same as `mb_convert_kana()`.

```
$text = Str::kana(str: 'abｃあいうｱｲｳ', option: 'KVa');

// abcあいうアイウ
```

### Str::truncate(string $str, int $limit = 100, string $end = '...'): string

[](#strtruncatestring-str-int-limit--100-string-end---string)

`Str::limit()` counts half-width characters as 1 and full-width characters as 2 when truncating. It uses multibyte functions but counts by character width.

```
$text = Str::limit('abcあいうえお', 7);

// abcあい...
```

`Str::truncate()` counts by the number of characters for truncation, which works better for Japanese text.

```
$text = Str::truncate(str: 'abcあいうえお', limit: 7);

// abcあいうえ...
```

Fluent Strings
--------------

[](#fluent-strings)

### textwrap(int $width = 10, string $break = PHP\_EOL): Stringable

[](#textwrapint-width--10-string-break--php_eol-stringable)

```
$text = Str::of('abcde')->textwrap(width: 3)->value();

// abc
// de
```

### kana(string $option = 'KV', string $encoding = 'UTF-8'): Stringable

[](#kanastring-option--kv-string-encoding--utf-8-stringable)

```
$text = Str::of('abｃあいうｱｲｳ')->kana(option: 'KVa')->value();

// abcあいうアイウ
```

For chaining use:

```
$text = Str::of('abｃあいうｱｲｳ')->kana(option: 'KVa')->textwrap(3)->value();

// abc
// あいう
// アイウ
```

### truncate(int $limit = 100, string $end = '...'): Stringable

[](#truncateint-limit--100-string-end---stringable)

```
$text = Str::of('abcあいうえお')->truncate(limit: 6, end: '___')->value();

// abcあいう___
```

LICENSE
-------

[](#license)

MIT

###  Health Score

56

—

FairBetter than 98% of packages

Maintenance85

Actively maintained with recent releases

Popularity30

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 88.2% 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 ~73 days

Recently: every ~229 days

Total

28

Last Release

86d ago

Major Versions

1.0.0 → 2.0.02020-10-02

1.0.1 → 2.0.22020-10-02

1.0.2 → 2.0.32020-10-03

1.0.3 → 2.0.42020-10-04

1.x-dev → 2.1.02021-01-01

PHP version history (7 changes)0.0.1PHP ^7.3||^8.0

1.0.0PHP ^7.4||^8.0

2.0.3PHP ^7.2||^8.0

2.3.0PHP ^8.0

2.6.0PHP ^8.1

2.7.0PHP ^8.2

2.8.0PHP ^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/77618633?v=4)[Revolution](/maintainers/revolution)[@Revolution](https://github.com/Revolution)

---

Top Contributors

[![kawax](https://avatars.githubusercontent.com/u/1502086?v=4)](https://github.com/kawax "kawax (67 commits)")[![devin-ai-integration[bot]](https://avatars.githubusercontent.com/in/811515?v=4)](https://github.com/devin-ai-integration[bot] "devin-ai-integration[bot] (4 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (3 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (2 commits)")

---

Tags

laravelmixinsstr

###  Code Quality

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/revolution-laravel-str-mixins/health.svg)

```
[![Health](https://phpackages.com/badges/revolution-laravel-str-mixins/health.svg)](https://phpackages.com/packages/revolution-laravel-str-mixins)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)[nedwors/navigator

A Laravel package to ease defining navigation menus

433.1k](/packages/nedwors-navigator)[xefi/faker-php-laravel

Faker php integration with laravel

1915.1k](/packages/xefi-faker-php-laravel)[dcblogdev/laravel-junie

Install pre-configured guides for Jetbrains Junie

392.5k](/packages/dcblogdev-laravel-junie)

PHPackages © 2026

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