PHP code example of sgmendez / jsonbundle

1. Go to this page and download the library: Download sgmendez/jsonbundle 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/ */

    

sgmendez / jsonbundle example snippets



// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Sgmendez\Bundle\JsonBundle\JsonBundle(),
        // ...
    );
}

php

$json = $this->get('json.parser');
$a = $json->decode($stringJson);


php

$json = $this->get('json.parser');
$a = $json->decodeFile('file.json');


php

$json = $this->get('json.parser');
$a = $json->decodeFile('http://ip.jsontest.com/');