PHPackages                             procionegobbo/polygen-php - 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. procionegobbo/polygen-php

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

procionegobbo/polygen-php
=========================

PHP 8.4+ implementation of Polygen - random sentence generator with BNF-like grammars

v1.1.2(3mo ago)035MITPHPPHP &gt;=8.4CI passing

Since Mar 13Pushed 2mo agoCompare

[ Source](https://github.com/Procionegobbo/polygen-php)[ Packagist](https://packagist.org/packages/procionegobbo/polygen-php)[ Docs](https://github.com/Procionegobbo/polygen-php)[ RSS](/packages/procionegobbo-polygen-php/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (4)Dependencies (2)Versions (7)Used By (0)

Polygen PHP 8.4+ Port
=====================

[](#polygen-php-84-port)

A PHP 8.4+ implementation of Polygen - a random sentence generator based on BNF-like grammar definitions.

Disclaimer
----------

[](#disclaimer)

This project is a tribute to the legendary **Polygen**. It was created almost entirely with Claude Code and makes no claim to approach the brilliance of Alvise Spanò's original implementation. The purpose of this project is simply to try to create a Composer-compatible implementation for the PHP community.

Features
--------

[](#features)

- Full implementation of the Polygen Meta Language (PML) parser
- Recursive grammar evaluation with label filtering
- Weighted random selection with shuffle algorithm
- Support for definitions (`::=`) and assignments (`:=`)
- Optional groups `[...]`
- Mobile/shuffle groups `{...}` with all permutations
- Multi-label selectors `.(label1|label2)`
- Scoped redefinitions with inline declarations `(X := value; body)`
- Deep unfold operator `>>...
