PHP code example of masnathan / parser
1. Go to this page and download the library: Download masnathan/parser library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
masnathan / parser example snippets
$content = Parser::file('path/to/my/file.json')->from('json');
echo $content->to('xml'); // outputs in xml format
// or
echo Parser::file('path/to/my/file.xml')
->from('xml')
->setPrettyOutput(true)
->to('yaml');
php
use MASNathan\Parser\Parser;
$data = array(
'foo' => 'bar',
'sup' => 'World'
);
$content = Parser::data($data);
$content->setPrettyOutput(true);
echo $content->to('json'); // outputs in json format
echo $content->to('xml'); // outputs in xml format