← All languages

wildling

PHP library and CLI for pattern-based string generation. Zero Composer dependencies (PHP standard library only). Requires PHP 8.1+.

Example

Install

From this repository:

cd php
./build.sh
./bin/wildling "Year 19##"

Registry (Packagist via dotmonk/wildling-php):

composer require dotmonk/wildling

Path (monorepo clone):

{
  "repositories": [{ "type": "path", "url": "./php" }],
  "require": { "dotmonk/wildling": "*" }
}

As a library:

<?php
require 'vendor/autoload.php';

use Wildling\Wildling;

$wildling = Wildling::create(['Year 19##']);
$value = $wildling->next();
while ($value !== false) {
    echo $value, "\n";
    $value = $wildling->next();
}

CLI

./bin/wildling "Year 19##"
./bin/wildling --dictionary planets:../dictionaries/planets.txt "%{'planets'}"
./bin/wildling --template ./config.json

The launcher uses local php when available, otherwise Docker (php:8.3-cli-alpine).

Help text and --check output follow docs/cli.md / docs/help.txt.

Build

./build.sh   # Docker: copy help.txt + php -l syntax check

Project tests live in ../tests/ and are run with ../test.sh.