PHP code example of johnsquibb / adventure-game-markup-language

1. Go to this page and download the library: Download johnsquibb/adventure-game-markup-language library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

johnsquibb / adventure-game-markup-language example snippets

 
$markup = <<<END
[ITEM]
# Attributes
id=flashlight
size =2
readable = yes
name = Small Flashlight

# Interactions
acquirable=yes
activatable=yes
deactivatable=no

# Tags 
tags=flashlight,light,magic torch stick

[description]
A black metal flashlight that runs on rechargeable batteries.
There is a round gray button for activating it.
There is some small text printed on a label on the side of the flashlight.

[text]
Information written on the side:
Model: Illuminated Devices Inc
Year: 1983
Serial Number: 8301IDI001256703
Batt. Type: (4) AA
END;

// Transpile AGML into Hydrator objects.
$lexer = new Lexer();
$parser = new Parser();
$transpiler = new Transpiler($lexer, $parser);

$hydrators = $transpiler->transpile($markup);