public static function encodeFromFile($file, array $parameters = array())
    {
        $json = new JSON();

        $encoder = function($file) use ($parameters, $json) {
            extract($parameters);
            include $file;

            return $json;
        };

        return json_encode($encoder->__invoke($file));
    }
public static function encodeFromFile($file, array $parameters = array())
    {
        $json = new JSON();

        $encoder = function($file) use ($parameters, $json) {
            extract($parameters);
            include $file;

            return $json;
        };

        return json_encode($encoder->__invoke($file));
    }
public static function encodeFromFile ( $ file , array $ parameters = array ( ) ) { $ json = new JSON ( ) ; $ encoder = function ( $ file ) use ( $ parameters , $ json ) { extract ( $ parameters ) ; include $ file ; return $ json ; } ; return json_encode ( $ encoder -> __invoke ( $ file ) ) ; }
Encode JSON from view file

inline example:

echo Encoder::encodeFromFile('/path/to/index.json.php');

@param $file
@param array $parameters
@return string
Encode JSON from view file