lukezbihlyj / vdf-parser
An open-source VDF parser for Valve's proprietary format used in Source games.
Installs: 6 841
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 1
Forks: 3
Open Issues: 4
Requires
- php: >=5.4.0
Requires (Dev)
- phpunit/phpunit: 4.5.*
This package is auto-updated.
Last update: 2025-01-06 00:46:28 UTC
README
An open-source VDF parser for Valve's proprietary format used in Source games. This package is 100% tested and available for use in any project under the MIT license. The parser currently supports all features of VDF, including:
- Arbitrary whitespace, including tab characters and spaces.
- Comments, which will be ignored during parsing.
- Escaped strings, allowing backslash escaping inside strings for both keys and values.
- Nested arrays, using recursion.
Installation
Via Composer
Add the following to your composer.json
file and run composer update
to update the dependencies and pull in the new package.
"require": { "lukezbihlyj/vdf-parser": "~1.0" }
Usage
Parsing
$string = <<<VDF { "key" "value" } VDF; $parser = new VdfParser\Parser; $result = $parser->parse($string); // // $result = [ // 'key' => 'value' // ] //
Testing
Unit tests are available and we strive to achieve 100% code coverage. Running the test suite is incredibly simple.
$ composer install $ php vendor/bin/phpunit -c test/phpunit.xml
In addition to the phpunit results being output to the terminal, code coverage documentation will also be generated under the build/
directory.