PHPackages                             jstewmc/rtf-token - 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. jstewmc/rtf-token

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

jstewmc/rtf-token
=================

Rich Text Format (RTF) tokens

v0.1.0(9y ago)023MITPHP

Since Dec 10Pushed 9y ago1 watchersCompare

[ Source](https://github.com/jstewmc/rtf-token)[ Packagist](https://packagist.org/packages/jstewmc/rtf-token)[ RSS](/packages/jstewmc-rtf-token/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (2)Used By (0)

rtf-token
=========

[](#rtf-token)

Rich Text Format (RTF) tokens.

```
namespace Jstewmc\RtfToken;

$open    = new Group\Open();
$control = new Control\Word('foo');
$text    = new Text('bar');
$close   = new Group\Close();

echo $open . $control . $text . $close;
```

The example above would output the following:

```
{\foo bar}

```

Tokens
------

[](#tokens)

This library includes tokens for the Rich Text Format (RTF) language including:

- open-group (i.e., `{`),
- close-group (i.e., `}`),
- control word (e.g., `\b`),
- control symbol (e.g., `\*`),
- text (e.g., `foo`), and
- other (e.g., `\0`).

The properties of each token differ, but all tokens implement the `_toString()` magic method.

### Group

[](#group)

This library supports two group tokens: `Group\Open` and `Group\Close`. They have no properties:

```
namespace Jstewmc\RtfToken\Group;

(string) (new Open());   // returns "{"
(string) (new Close());  // returns "}"
```

### Controls

[](#controls)

This library supports *control word* and *control symbol* tokens.

By default, control tokens are space-delimited. However, this can be turned off using the `setIsSpaceDelimited()` method.

#### Control words

[](#control-words)

The control word token has a *word* and (optional) integer *parameter* property:

```
namespace Jstewmc\RtfToken\Control;

$word = new Word('b', 0);

$word->getWord();       // returns "b"
$word->getParameter();  // returns 0

(string) $word;  // returns "\b0 "

$word->setIsSpaceDelimited(false);

(string) $word;  // returns "\b0" (note, no space)
```

#### Control symbol

[](#control-symbol)

The control symbol token has a *symbol* and mixed *parameter* property:

```
namespace Jstewmc\RtfToken\Control;

$symbol = new Symbol('\'', 99);

$symbol->getSymbol();     // returns "'"
$symbol->getParameter();  // returns 99

(string) $symbol;  // returns "\'99 "

$symbol->setIsSpaceDelimited(false);

(string) $symbol;  // returns "\'99" (note, no space)
```

### Text

[](#text)

The text token has a single property, *text*:

```
namespace Jstewmc\RtfToken;

$text = new Text('foo');

$text->getText();  // returns "foo"

(string) $text;  // returns "foo"
```

### Other

[](#other)

The "other" token exists for any character that isn't an *open-group*, *close-group*, *control word*, *control symbol*, or *text* token. Usually, this includes special characters like line-feeds ("\\n"), carriage-returns ("\\r"), etc.

The "other" token has a single property, *character*:

```
namespace Jstewmc\RtfToken;

$other = new Other("\n");

$other->getCharacter();  // returns "\n"

(string) $other;  // returns "\n"
```

That's about it!

Author
------

[](#author)

[Jack Clayton](mailto:clayjs0@gmail.com)

Version
-------

[](#version)

### 0.1.0, December 10, 2016

[](#010-december-10-2016)

- Initial release

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

Unknown

Total

1

Last Release

3488d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/50fecae0a7fd2119681bc133e496e7166b01a59f850a3c909e100bd427c6b28b?d=identicon)[Jstewmc](/maintainers/Jstewmc)

---

Top Contributors

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

---

Tags

phptokenformatrtftextrich

### Embed Badge

![Health badge](/badges/jstewmc-rtf-token/health.svg)

```
[![Health](https://phpackages.com/badges/jstewmc-rtf-token/health.svg)](https://phpackages.com/packages/jstewmc-rtf-token)
```

###  Alternatives

[jstewmc/rtf

Read and write Rich Text Format (RTF) documents with PHP

46143.1k6](/packages/jstewmc-rtf)[povils/figlet

Figlet text generator - PHP

627.2k5](/packages/povils-figlet)[akh/typograf

Типография текста

1927.9k2](/packages/akh-typograf)[sinergi/token

PHP library to generate random strings

188.8k9](/packages/sinergi-token)

PHPackages © 2026

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