yii\base\Application::getResponse PHP Method

getResponse() public method

Returns the response component.
public getResponse ( ) : Response | yii\console\Response
return yii\web\Response | yii\console\Response the response component.
    public function getResponse()
    {
        return $this->get('response');
    }

Usage Example

 /**
  * Bootstrap method to be called during application bootstrap stage.
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     if ($app instanceof \yii\web\Application) {
         $app->getResponse()->formatters[self::FORMAT_CSV] = \SamIT\Yii2\Formatters\CsvResponseFormatter::class;
     }
 }