The CakePHP 3 autoLayout(false) method from another answer will still try to find the appropriate view / template file for the action you are invoking. Since I don't need any output at all, this did not work for me, so I also needed to create an empty template.
Creating an empty .ctp file for each empty action that you might need is not an option because you usually want to use and reuse it. CakePHP 2 has the $this->viewPath , which allows you to configure the controller to search in the app/View folder, but the CakePHP 3 alternative still looks at the corresponding controller and prefix folders. There is a less obvious way to get CakePHP3 to look for a pattern in the root view.
In addition, I use $this->viewBuilder()->layout(false) instead of autoLayout(false) , because the latter type implies that there may be another layout later, where layout(false) just explicitly sets that the layout is not required .
source share