PHPackages                             delights/extended-tokens - 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. delights/extended-tokens

Abandoned → [felixdorn/tin](/?search=felixdorn%2Ftin)ArchivedLibrary[Parsing &amp; Serialization](/categories/parsing)

delights/extended-tokens
========================

Facilitate PHP code highlighting by changing T\_STRING tokens to a more accurate representation

0.1.2(5y ago)01041MITPHPPHP ^7.3

Since Jul 20Pushed 4y agoCompare

[ Source](https://github.com/felixdorn/extended-tokens)[ Packagist](https://packagist.org/packages/delights/extended-tokens)[ RSS](/packages/delights-extended-tokens/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (8)Versions (4)Used By (1)

\*\*DEPRECATED use [felixdorn/tin](https://github.com/felixdorn/tin) instead, the code was crap, please don't look at it. Also the T\_FULL\_NAMESPACE never worked well and PHP parses namespaces as one token now.

Extended Tokens
===============

[](#extended-tokens)

```
composer require delight/extended-tokens

```

This package is meant to facilitate PHP code highlighting by changing T\_STRING tokens to a more accurate representation, like T\_CLASS\_NAME.

PHP ships by default with a Parser for PHP via the method `token_get_all`

This function returns an array of tokens that looks like this :

```
[
    T_TOKENTYPE,
    "value",
    42 // offset
];
```

Sometimes for tokens like `{`, `;`, it just returns the literal string, not an array. g This library change this, everything is an array, even those useless string.

Usage
-----

[](#usage)

```
use Delight\ExtendedTokens\ExtendedTokens;

$parser = new ExtendedTokens();
$tokens = $parser->parse('code');
```

### T\_FULL\_NAMESPACE

[](#t_full_namespace)

```
namespace A\B\C;
```

- `A\B\C` will be a T\_FULL\_NAMESPACE

### T\_CLASS\_NAME

[](#t_class_name)

```
class A {}
```

- `A` will be a T\_CLASS\_NAME

```
new A;
```

- `A` will be a T\_CLASS\_NAME

### T\_FUNCTION\_NAME

[](#t_function_name)

```
function hello() {}
```

- `hello` will be a T\_FUNCTION\_NAME

### T\_CONST\_NAME

[](#t_const_name)

```
const E = 'F';
```

- `E` will be a T\_CONST\_NAME

### T\_EQUAL

[](#t_equal)

```
$a = 1;
```

- `=` will be a T\_EQUAL

### T\_CONCAT

[](#t_concat)

```
$c = 'a' . 'b';
```

- `.` will be a T\_CONCAT

### T\_VARIABLE after T\_OBJECT\_OPERATOR

[](#t_variable-after-t_object_operator)

```
$a->b;
```

- `b` will be a T\_VARIABLE instead of a T\_STRING

### T\_VARIABLE\_TYPE

[](#t_variable_type)

```
function world(string $name): World {}
```

- `string` will be a T\_VARIABLE\_TYPE
- `World` will be a T\_CLASS\_NAME

### T\_TRUE and T\_FALSE

[](#t_true-and-t_false)

```
true && false;
```

- `true` will be a T\_TRUE
- `false` will be a T\_FALSE

### T\_REF

[](#t_ref)

```
function (int &$index) {}
```

- `&` will be a T\_REF

### T\_NEGATION

[](#t_negation)

```
!true;
```

- `!` will be a T\_NEGATION

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity42

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

Every ~17 days

Total

3

Last Release

2087d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

phptokensparserextended

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/delights-extended-tokens/health.svg)

```
[![Health](https://phpackages.com/badges/delights-extended-tokens/health.svg)](https://phpackages.com/packages/delights-extended-tokens)
```

###  Alternatives

[doctrine/lexer

PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.

11.2k910.8M118](/packages/doctrine-lexer)[simplehtmldom/simplehtmldom

A fast, simple and reliable HTML document parser for PHP.

1921.3M14](/packages/simplehtmldom-simplehtmldom)[corveda/php-sandbox

A PHP library that can be used to run PHP code in a sandboxed environment

23483.5k2](/packages/corveda-php-sandbox)[romanpitak/nginx-config-processor

Nginx configuration files processor.

7235.3k1](/packages/romanpitak-nginx-config-processor)[sbsaga/toon

🧠 TOON for Laravel — a compact, human-readable, and token-efficient data format for AI prompts &amp; LLM contexts. Perfect for ChatGPT, Gemini, Claude, Mistral, and OpenAI integrations (JSON ⇄ TOON).

6115.6k](/packages/sbsaga-toon)[leonelquinteros/php-toml

PHP parser for TOML language ( https://github.com/toml-lang/toml )

266.7k](/packages/leonelquinteros-php-toml)

PHPackages © 2026

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