Reading/writing NEON files

materix
Backer | 83
+
0
-

With Symfony YAML you can read/write from files like this:

use Symfony\Component\Yaml\Yaml;

$array = [
    'foo' => 'bar',
    'bar' => ['foo' => 'bar', 'bar' => 'baz'],
];

$yaml = Yaml::dump($array);

file_put_contents('/path/to/file.yaml', $yaml);

or

$value = Yaml::parseFile('/path/to/file.yaml');

How can we do the same thing with NEON-files in a standalone php-file? (without all nette-framework)

Milo
Nette Core | 1283
+
+2
-
materix
Backer | 83
+
0
-

Thanks for the tip.

I can not find any parseFile-command. But perhaps file_get_contents is good enough?

Rick Strafy
Nette Blogger | 81
+
+2
-

Yes, it is good enough.

Kcko
Member | 468
+
0
-

Dont forget to use nette.safe:// protocol ;)