PHPackages                             bentools/violin - 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. bentools/violin

ActiveLibrary

bentools/violin
===============

A multibyte string manipulation library focused on performance.

11.4k2PHP

Since May 7Pushed 7y ago1 watchersCompare

[ Source](https://github.com/bpolaszek/violin)[ Packagist](https://packagist.org/packages/bentools/violin)[ RSS](/packages/bentools-violin/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependenciesVersions (1)Used By (2)

[![Latest Stable Version](https://camo.githubusercontent.com/49962bb979102a31ca0ec8ee1a0f379b0205ab32c15811db04d6aaee866c3059/68747470733a2f2f706f7365722e707567782e6f72672f62656e746f6f6c732f76696f6c696e2f762f737461626c65)](https://packagist.org/packages/bentools/violin)[![License](https://camo.githubusercontent.com/b23d0ccfd8c133ceee1f005b74cd47f3499df619a49645ef588c0e5a2c6afe13/68747470733a2f2f706f7365722e707567782e6f72672f62656e746f6f6c732f76696f6c696e2f6c6963656e7365)](https://packagist.org/packages/bentools/violin)[![Build Status](https://camo.githubusercontent.com/3f8671f89f843754adad0aa3b0f60234cb02a029709a9b354a6ea34f76716ca3/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f62706f6c61737a656b2f76696f6c696e2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/bpolaszek/violin)[![Coverage Status](https://camo.githubusercontent.com/58222c306e0e407104e034d2eb85ede31c2937d345e2ce0e779858b7d93b2df2/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f62706f6c61737a656b2f76696f6c696e2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/bpolaszek/violin?branch=master)[![Quality Score](https://camo.githubusercontent.com/a018dde4f6d742ba1561780f9bbac5fc616eca80f6a407afc40a26f17cf0a1b3/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f62706f6c61737a656b2f76696f6c696e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/bpolaszek/violin)[![Total Downloads](https://camo.githubusercontent.com/21e4bf1306787ce56ee264ef930bd0245cad202f44d0343ecb4693361471c5cf/68747470733a2f2f706f7365722e707567782e6f72672f62656e746f6f6c732f76696f6c696e2f646f776e6c6f616473)](https://packagist.org/packages/bentools/violin)

Violin 🎻
========

[](#violin-)

Violin is a multibyte-compliant, OOP string manipulation library.

It is heavily inspired by [Stringy](https://github.com/danielstjules/Stringy), with a main focus on performance: when dealing with thousands of strings, it is sometimes counter-productive to rely on `mb_*` functions, which perform up to 4 times slower than normal `str_*` functions, when you manipulate ASCII strings.

Violin will detect the string's encoding, then decide wether or not to use the mbstring extension (or the Symfony polyfill if the extension is not loaded).

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

[](#installation)

PHP 7.1+ is required.

```
composer require bentools/violin 1.0.x-dev
```

Tests
-----

[](#tests)

```
./vendor/bin/phpunit
```

Usage
-----

[](#usage)

```
use BenTools\Violin\Violin;

$str = 'fòöbàř     🤗';
print Violin::tune($str)
        ->toUpperCase()
        ->ensureLeft('Welcome ')
        ->collapseWhitespace(); // Welcome FÒÖBÀŘ 🤗
```

License
-------

[](#license)

MIT

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/acdd1a8ee0e657ddd06cf11f98a32100ef7121afb8aa270a5b295f5c29c038b3?d=identicon)[bpolaszek](/maintainers/bpolaszek)

---

Top Contributors

[![bpolaszek](https://avatars.githubusercontent.com/u/5569077?v=4)](https://github.com/bpolaszek "bpolaszek (15 commits)")

### Embed Badge

![Health badge](/badges/bentools-violin/health.svg)

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

PHPackages © 2026

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