arcadis-intelligence / gomphplate
A wrapper for the yaml templating engine gomplate
0.2.1
2025-03-04 14:28 UTC
Requires
- php: ^8.1
- illuminate/contracts: ^11.43
- symfony/filesystem: ^7.2
- symfony/process: ^7.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.69
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^12.0
README
Requirements
- PHP 8.0 or higher
- Gomplate
Configuration
You can specify the path to the gomplate binary by setting the GOMPLATE_PATH
environment variable.
Installation
composer require arcadis-intelligence/gomphplate
Usage
use ArcadisIntelligence\Gomphplate\Gomphplate; $template = <<<YAML people: {{- range .people }} - name: {{ .name }} age: {{ .age }} {{- end }} YAML; $data = [ 'people' => [ ['name' => 'Alice', 'age' => 30], ['name' => 'Bob', 'age' => 25], ], ]; $renderedYaml = Gomphplate::renderYaml($template, $data);
Should produce
people: - name: Alice age: 30 - name: Bob age: 25