Hey, does anyone know how I can use gzencode + json if I want to use renderAs json?
eg. gzenencode:
header(‘Content-Encoding: gzip’);
$output = gzencode(json_encode($data));
eg. renderAs json:
$this->RequestHandler->renderAs($this, ‘json’);
any idea? thanks…
See the AjaxView included with the app.
You can create a class that extends JsonView to apply that function and set the right headers
and then just set with
// if you name is src/View/GzipView.php
$this->viewBuilder()->setClass('Gzip');
JsonView? it does not exist in my View folder… I use cakephp ‘4.2.8’
Its part of the cakephp framework
ok i see its in the vendor folder… thank you! lets see if i can do what you described… =)