Yii 2.0 How to extend Core Classes

I want to extend the class yii\web\Response. So I created a new class Response in the folder components and I try to overwrite the send method.

    namespace app\components;

    use Yii;

    class Response extends \yii\web\Response{

	    public function init(){





	     * Sends the response to the client.


	    public function send()

	    { ...

Finally I tried to import my new Response-Class by importing it in the config.

    $config = [

        'id' => 'basic',

        'basePath' => dirname(__DIR__),

        'bootstrap' => ['log'],

        'components' => [

            'import'  => [

            	'class' => 'app\components\Response',		


Why is it not going to work like this?

Not completly sure since I have not overwritten any core-class so far.

But after a look at:


I think it should be:

'components' => [

	'respone'  => [

		'class' => 'app\components\Response',           



For my understanding you are then able to use it like:


Also I think - WHEN you have use statements of the Reponse class somewhere in your files - you have to change the use statement to:

// from

// use yii\web\Response; 

// to

use app\components\Response; 


you delare it as ‘import’ so locator will put it as \Yii:$app->import