PHPackages                             grasmash/yaml-expander - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. grasmash/yaml-expander

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

grasmash/yaml-expander
======================

Expands internal property references in a yaml file.

3.0.3(2y ago)15431.8M—2.1%11[1 PRs](https://github.com/grasmash/yaml-expander/pulls)9MITPHPCI passing

Since Jan 13Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/grasmash/yaml-expander)[ Packagist](https://packagist.org/packages/grasmash/yaml-expander)[ RSS](/packages/grasmash-yaml-expander/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (5)Versions (25)Used By (9)

[![CI](https://github.com/grasmash/yaml-expander/actions/workflows/php.yml/badge.svg)](https://github.com/grasmash/yaml-expander/actions/workflows/php.yml) [![Packagist](https://camo.githubusercontent.com/110b63a02ba8e994e9902f4dd3f6bce0a8e21f627d8cf1ac8876083e6335cbcd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f677261736d6173682f79616d6c2d657870616e6465722e737667)](https://packagist.org/packages/grasmash/yaml-expander)[![Total Downloads](https://camo.githubusercontent.com/94b58cd6f1c574f4c2b009a50e050b3184e224fb7fe0aecd2e960e4ddcbbd7e8/68747470733a2f2f706f7365722e707567782e6f72672f677261736d6173682f79616d6c2d657870616e6465722f646f776e6c6f616473)](https://packagist.org/packages/grasmash/yaml-expander) [![Coverage Status](https://camo.githubusercontent.com/ab5ad1eaff7fcb818b3514596c9304b6310d04f1b59a17a2e532668f526585d1/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f677261736d6173682f79616d6c2d657870616e6465722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/grasmash/yaml-expander?branch=master)

This tool expands property references in YAML files.

### Installation

[](#installation)

```
composer require grasmash/yaml-expander

```

### Example usage:

[](#example-usage)

Example dune.yml:

```
type: book
book:
  title: Dune
  author: Frank Herbert
  copyright: ${book.author} 1965
  protaganist: ${characters.0.name}
  media:
    - hardcover
characters:
  - name: Paul Atreides
    occupation: Kwisatz Haderach
    aliases:
      - Usul
      - Muad'Dib
      - The Preacher
  - name: Duncan Idaho
    occupation: Swordmaster
summary: ${book.title} by ${book.author}
product-name: ${${type}.title}
timezone: ${env.TZ}
```

Property references use dot notation to indicate array keys, and must be wrapped in `${}`.

Expansion logic:

```
