Error autoloading class if folder name is not the same as the namespace

I have the following folders in my app: extended/yii2-imagine/Image.php with the following namespace: namespace app\extended\imagine;

When I use it I get an exception telling me “Class ‘app\extended\imagine\Image’ not found”. The only way I made this work is by changing the folder name from yii2-imagine to imagine.

Is this how it’s supposed to work?

you should configure autoloader