PHPackages                             placemat/editor - 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. placemat/editor

Abandoned → [hipsterjazzbo/editor](/?search=hipsterjazzbo%2Feditor)Library[Utility &amp; Helpers](/categories/utility)

placemat/editor
===============

A clean, elegant, unicode-safe, fluent, immutable, localisable, dependency-free string manipulation library for PHP 7.1+

v2.0.3(5y ago)16.5kMITPHPPHP &gt;=7.1CI failing

Since Aug 5Pushed 5y ago1 watchersCompare

[ Source](https://github.com/hipsterjazzbo/editor)[ Packagist](https://packagist.org/packages/placemat/editor)[ RSS](/packages/placemat-editor/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (2)Versions (11)Used By (0)

Editor
======

[](#editor)

[![Editor](https://github.com/helloplacemat/editor/raw/master/readme-header.jpg)](https://github.com/helloplacemat/editor/raw/master/readme-header.jpg)

[![Build Status](https://camo.githubusercontent.com/83b80a6d509c826c15b53b1d2218019b48b80c2d34f0731ee1c2ff4262ab1558/68747470733a2f2f7472617669732d63692e6f72672f68656c6c6f706c6163656d61742f656469746f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/helloplacemat/editor)[![Coverage Status](https://camo.githubusercontent.com/8803b2d50e38f3267531e03ff80016e61b55e7d1bc247f70d8bf45716c23a176/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f68656c6c6f706c6163656d61742f656469746f722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/helloplacemat/editor?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/875f2141f38a9d6ba16a992ae89321357f5dbc8ddc9115bd05281bda01b9daae/68747470733a2f2f706f7365722e707567782e6f72672f706c6163656d61742f656469746f722f762f737461626c65)](https://packagist.org/packages/placemat/editor)[![Latest Unstable Version](https://camo.githubusercontent.com/9bd89dd9676cf18167c3fee8dbddb757d16f11ac79594a6ca56f97ce6ce56525/68747470733a2f2f706f7365722e707567782e6f72672f706c6163656d61742f656469746f722f762f756e737461626c65)](https://packagist.org/packages/placemat/editor)[![Total Downloads](https://camo.githubusercontent.com/38c953337ea21c37caedb70b216f95095e76696901215c9c624693e698095e23/68747470733a2f2f706f7365722e707567782e6f72672f706c6163656d61742f656469746f722f646f776e6c6f616473)](https://packagist.org/packages/placemat/editor)[![License](https://camo.githubusercontent.com/fbd851d534308785131aa1a86f1fb7ac9c993786d61b035080be4ba7bb866a4c/68747470733a2f2f706f7365722e707567782e6f72672f706c6163656d61742f656469746f722f6c6963656e7365)](https://packagist.org/packages/placemat/editor)

A clean, elegant, unicode-safe, fluent, immutable, localisable, dependency-free string manipulation library for PHP 7.1+

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

[](#installation)

You can install the package via composer:

```
composer require placemat/editor
```

Usage
-----

[](#usage)

### Create an instance

[](#create-an-instance)

To use Editor, first you've got to instantiate it on your string:

```
echo Editor::create('hello world')->upperCase();

// HELLO WORLD
```

That's a little verbose though, so Editor comes with a global helper function too:

```
echo s('hello world')->upperCase();

// HELLO WORLD
```

### Do some stuff!

[](#do-some-stuff)

Editor is fluent and chainable, so you can just keep adding operations to each other:

```
echo s('    EDITOR is pretty neat I guess 💩      ')
    ->trim()
    ->titleCase();

// Editor is Pretty Neat I Guess 💩
```

Editor is also immutable, so you won't mess up your original instance:

```
$str = s('Apple');

echo $str->plural(); // Apples

echo $str; // Apple
```

Editor implements PHP's `__toString()` magic method, so in most cases you can just use it like a string and it'll work just fine:

```
$str = s('worlds');

echo 'Hello ' . $str->singular()->upperCaseFirst();

// Hello World
```

If you *do* need to get a regular string back for whatever reason, you can either cast an instance of Editor, or call `str()`:

```
$hello = s('Hello World');

(string) $hello; // Will be a string

$hello->str(); // Will also be a string
```

### Title Casing

[](#title-casing)

Editor implements proper title casing, based on [John Gruber's crazy title casing script](https://gist.github.com/gruber/9f9e8650d68b13ce4d78):

```
s('this is a headline that will be properly title-cased')->titleCase();

// This Is a Headline That Will Be Properly Title-Cased
```

If you're after what other libraries so boldly claim is title case, you want `upperCaseFirst()`:

```
s('this is not actually title casing')->upperCaseFirst();

// This Is Not Actually Title-casing
```

### Inflection

[](#inflection)

Editor supports making a string singular or plural:

```
s('apples')->singular(); // 'apple'

s('apple')->plural(); // 'apples'

// plural also has a $count parameter, in case you need to pluralize dynamically
s('apple')->plural($count); // 'apple' if $count is 1, 'apples' otherwise
```

Inflections are localizable in Editor. Right now, Editor supports 6 languages:

- English ('en')
- Spanish ('es')
- French ('fr')
- Portuguese ('pt')
- Norwegian Bokmal ('nb')
- Turkish ('tr')

```
s('bijou')->plural($count, 'fr'); // 'bijoux'
```

> If you'd like to add an inflector, simply
>
> - Extend `Hipsterjazzbo\Editor\Inflectors\Inflector`
> - Register with `Editor::registerInflector($inflector)`
> - That's it!
>
> If you do add inflectors, feel free to open a Pull Request!

Function Reference
------------------

[](#function-reference)

Full function reference documentation is probably something I should write. But for now, you can peruse [the main Editor class](/src/Editor.php). Every method is doc-blocked and tested 👍

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

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

Recently: every ~137 days

Total

10

Last Release

2181d ago

Major Versions

v0.1.1-beta → v1.02018-08-10

v1.0.3 → v2.0.02020-04-01

### Community

Maintainers

![](https://www.gravatar.com/avatar/5f7f507b3da5a01b1cdb32f8185d5e45445135a835e807e170922ceba4b82fd9?d=identicon)[HipsterJazzbo](/maintainers/HipsterJazzbo)

---

Top Contributors

[![hipsterjazzbo](https://avatars.githubusercontent.com/u/231361?v=4)](https://github.com/hipsterjazzbo "hipsterjazzbo (35 commits)")

---

Tags

composer-packagefluentphpstring-manipulation

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/placemat-editor/health.svg)

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

###  Alternatives

[botman/driver-facebook

Facebook Messenger driver for BotMan

71301.6k6](/packages/botman-driver-facebook)

PHPackages © 2026

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