PHP TypeLang Help

Platforms

A platform is a named bundle of tag definitions, aliases and combinators — everything needed to teach the parser a family of tags.

A platform implements PlatformInterface, four read-only properties:

final class MoneyPlatform implements PlatformInterface { public string $name = 'money'; public iterable $aliases = []; public iterable $combinators = []; public iterable $tags { get => [ MoneyTagDefinition::NAME => new MoneyTagDefinition(), ]; } }
  • $name — a human-readable name for the platform.

  • $tagsdefinitions, keyed by each tag's canonical (lower-case) name.

  • $aliases — alternative-spelling to canonical-name pairs, both lower-case (this is how @template-implements is treated as @implements, for instance).

  • $combinators — any combinator the definitions reference that is not built in already, keyed by name.

Registering It

The platform is handed to DocBlockParser's constructor:

$parser = new DocBlockParser(platforms: [ new MoneyPlatform(), ]); $block = $parser->parse('/** @money 100 USD */');

The StandardPlatform is always loaded first, so every standard tag stays available; the platforms passed in extend it, each overriding an entry only when it reuses the same tag, alias or combinator name.

The definitions that end up registered are exposed as $parser->tags (a countable, iterable TagRegistryInterface), and the factory that builds tags from them as $parser->factory.

Where to Go Next

Definitions

What a $tags entry is. See Definitions.

Combinators

What a $combinators entry is. See Combinators.

12 July 2026