PHPackages                             mike-k-burke/php-rtflex - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. mike-k-burke/php-rtflex

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

mike-k-burke/php-rtflex
=======================

A simple library to allow parsing of RTF files and strings. Forked from skyh13/php-rtflex which is a fork of silvermine/php-rtflex.

0.6(7y ago)01291PHPPHP &gt;=5.3.0

Since Aug 20Pushed 7y agoCompare

[ Source](https://github.com/mike-k-burke/php-rtflex)[ Packagist](https://packagist.org/packages/mike-k-burke/php-rtflex)[ RSS](/packages/mike-k-burke-php-rtflex/feed)WikiDiscussions master Synced yesterday

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

RTFLex
======

[](#rtflex)

[![Build Status](https://camo.githubusercontent.com/15184ef6f3699ac57f0a139edd3f359b574300bd3c1a2a0e448ef1e7a1968848/68747470733a2f2f7472617669732d63692e6f72672f536b796831332f7068702d7274666c65782e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/Skyh13/php-rtflex)

RTFLex is a simple lexer / tokenizer for RTF formatted data.

Example Usage
-------------

[](#example-usage)

RTFLex allows you to easily extract plain text from an RTF formatted file, or a text string containing RTF formatting. Here's how you would read an RTF file:

```
require_once "rtflex/RTFLexer.php";

use RTFLex\io\StreamReader;
use RTFLex\tokenizer\RTFTokenizer;
use RTFLex\tree\RTFDocument;

$reader = new StreamReader('/path/to/myFile.rtf');
$tokenizer = new RTFTokenizer($reader);
$doc = new RTFDocument($tokenizer);
echo $doc->extractText();

```

While RTFLex uses namespaces to organize it's inner-workings, it also provides a simple, global, front-end class for easy of use. This accomplishes the same as the above code:

```
require_once "rtflex/RTFLexer.php";

$doc = RTFLexer::file('/path/to/myFile.rtf');
echo $doc->extractText();

```

RTFLex also lets you easily extract hidden metadata from an RTF file. Take, for example, the follow RTF header:

```
{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
{\info
{\title Sample Title}
{\subject Sample Subject}
{\author Craig Weber}
{\*\company silvermine}
{\*\copyright 2013 silvermine.}}\margl1440\margr1440\vieww10800\viewh8400\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural
...

```

Using the RTFDocument class, it's easy to extract those field.

```
$doc = RTFLexer::file('/path/to/myFile.rtf');
echo $doc->extractMetadata('title');     // => "Sample Title"
echo $doc->extractMetadata('copyright'); // => "2013 silvermine."

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 53.8% 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 ~208 days

Total

6

Last Release

2876d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/810dd142148c8e0befecef20b267038a6240835faf0f0f00aa4312ea7c806eb3?d=identicon)[mike-k-burke](/maintainers/mike-k-burke)

---

Top Contributors

[![Skyh13](https://avatars.githubusercontent.com/u/3751303?v=4)](https://github.com/Skyh13 "Skyh13 (21 commits)")[![crgwbr](https://avatars.githubusercontent.com/u/173216?v=4)](https://github.com/crgwbr "crgwbr (16 commits)")[![MikeBurke-RL](https://avatars.githubusercontent.com/u/32866933?v=4)](https://github.com/MikeBurke-RL "MikeBurke-RL (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mike-k-burke-php-rtflex/health.svg)

```
[![Health](https://phpackages.com/badges/mike-k-burke-php-rtflex/health.svg)](https://phpackages.com/packages/mike-k-burke-php-rtflex)
```

###  Alternatives

[mtdowling/jmespath.php

Declaratively specify how to extract elements from a JSON document

2.0k472.8M135](/packages/mtdowling-jmespathphp)[opis/closure

A library that can be used to serialize closures (anonymous functions) and arbitrary data.

2.6k230.0M284](/packages/opis-closure)[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M65](/packages/sabberworm-php-css-parser)[michelf/php-markdown

PHP Markdown

3.5k52.4M345](/packages/michelf-php-markdown)[jms/metadata

Class/method/property metadata management in PHP

1.8k152.8M88](/packages/jms-metadata)

PHPackages © 2026

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