PHPackages                             exayer/vdf-converter - 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. exayer/vdf-converter

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

exayer/vdf-converter
====================

Efficient, fast Valve Data Format (\*.vdf) parser

1.2.0(2y ago)4541MITPHPPHP &gt;=7.0

Since Sep 30Pushed 2y ago1 watchersCompare

[ Source](https://github.com/EXayer/vdf-converter)[ Packagist](https://packagist.org/packages/exayer/vdf-converter)[ RSS](/packages/exayer-vdf-converter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (1)Versions (8)Used By (0)

[![](logo.png)](logo.png)

VDF Converter
=============

[](#vdf-converter)

[![Tests](https://github.com/exayer/vdf-converter/workflows/Tests/badge.svg)](https://github.com/exayer/vdf-converter/workflows/Tests/badge.svg)[![Latest Stable Version](https://camo.githubusercontent.com/689bac680b3ce2d84e08a1c78ccda4579487883387846e09edacd97ab4a7866c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6578617965722f7664662d636f6e766572746572)](https://camo.githubusercontent.com/689bac680b3ce2d84e08a1c78ccda4579487883387846e09edacd97ab4a7866c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6578617965722f7664662d636f6e766572746572)

A memory efficient parser for the Valve Data Format (\*.vdf) written in PHP. Fully supports the [VDF specification](https://developer.valvesoftware.com/wiki/KeyValues), except for the `#include` macro.

Requirements
------------

[](#requirements)

PHP 7 or later. No production dependencies.

Install
-------

[](#install)

You can install the package via composer:

```
composer require exayer/vdf-converter
```

Usage
-----

[](#usage)

### Convert VDF to generator/array

[](#convert-vdf-to-generatorarray)

Let's say we are parsing the following VDF:

```
$vdf = '{
    "mercury" {
        "distance" "58"
    }
    "venus" {
        "distance" "108"
    }
    "earth" {
        "distance" "149"
    }
}';
```

It can be parsed in one of these ways (based on input source):

```
