Download the PHP package procionegobbo/polygen-php without Composer

On this page you can find all versions of the php package procionegobbo/polygen-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package polygen-php

Polygen PHP 8.4+ Port

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

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

Installation

Install via Composer:

Then use it in your code:

Usage

Basic Example

Using Alternatives

Optional Groups

Capitalization and Concatenation

Definitions vs Assignments

Architecture

The implementation follows the original OCaml architecture:

File Structure

PML Grammar Syntax

Basic Rules

Alternatives

Terminals (Operators)

Grouping

Labels and Selection

Known Limitations

The implementation supports nearly all core PML features. The following are not yet implemented:

Nested comments: Fully supported ✓ Mobile groups: Fully supported ✓ Deep unfold: Fully supported ✓ Multi-label selectors: Fully supported ✓ Scoped redefinitions: Fully supported ✓

Testing

Run the test suite with Composer:

Or run example scripts:

Future Developments

Numeric Label Selectors

The original OCaml Polygen supports numeric label selectors - using numeric indices as shortcuts for selecting alternatives:

This feature is used in approximately 5 real-world grammar files (3.4% of test suite). Implementation would require:

  1. Lexer enhancement: Support digit-only label tokens
  2. Parser update: Allow numeric selectors in label position
  3. Preprocessor mapping: Map numeric indices to internal label representation
  4. Generator support: Resolve numeric labels to alternatives

Status: Not implemented due to:

Workaround: Convert numeric labels to identifier-based labels:

Advanced Features

Other original Polygen features that could be added:

These remain low-priority due to niche usage and better alternatives available through standard PML syntax.

PML Specification & Resources

Official Documentation

PML Language Reference

The Polygen Meta Language (PML) is documented in the original Polygen repository:

Related Resources

Polygen PHP Documentation

This implementation includes:

Acknowledgments

This PHP 8.4+ implementation is a port of the original Polygen project by Alvise Spanò (@alvisespano).

The original Polygen is an OCaml implementation of a random sentence generator based on BNF-like grammars. This port preserves the core architecture and grammar syntax while adapting it for modern PHP with strict typing, sealed classes, and zero external dependencies.

Original Repository: https://github.com/alvisespano/Polygen

License

MIT License - Same terms as the original Polygen project.


All versions of polygen-php with dependencies

PHP Build Version
Package Version
Requires php Version >=8.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package procionegobbo/polygen-php contains the following files

Loading the files please wait ...