Upgrade HTTP Responses
What has been changed
The methods have been renamed
The methods in the HTTP Responses class are named slightly different. The most important change in the naming is the switch from underscored method names to camelCase. The method
set_content_type()from version 3 is now named
setContentType()and so on.
In the most cases you have to change
$this->responsefollowed by the method. You can find all methods in HTTP Responses.
CodeIgniter Version 3.x
<?php $this->output->set_status_header(404); // ... $this->output ->set_content_type('application/json') ->set_output(json_encode(array('foo' => 'bar')));
CodeIgniter Version 4.x
<?php $this->response->setStatusCode(404); // ... return $this->response->setJSON(['foo' => 'bar']);