Override core helper Url.php

I’m trying to override the helper class Url here is my code in common\components\helpers\Url.php

namespace common\components\helpers;

use Yii;

class Url extends \yii\helpers\Url



and in my entry script index.php

require __DIR__ . '/../../vendor/autoload.php';
require __DIR__ . '/../../vendor/yiisoft/yii2/Yii.php';
Yii::$classMap['yii\helpers\Url'] = __DIR__ . '/../../common/components/helpers/Url.php';

but when i load my page i get this error

Class "yii\helpers\Url" not found

What am i missing? Thank you.

never mind got! had to extend BaseUrl

class Url extends BaseUrl {