Where to save own "validator class"


I’m writing my own validator class which is extending from CValidator.

Where do I save the file in my project?


You can save it under extensions/ or create an extensions/validators/ folder

Also note the following post: http://www.yiiframework.com/forum/index.php?/topic/14438-do-not-use-c-for-prefixing-customextension-classes/

I usually let extension for bigger things

For 1 class use protected/components that is imported in your config

Ok, so whenever Yii finds an undefined class / method it automaticly checks the extensions folder?


It will check the imported folders

To import a folder you can


or in config/main.php

return array(







I just put it in the components folder and it works fine…