Model rules and validation in Yii framework

| Last Updated: | In: Yii framework


In this tutorial i explain the Model rules and validation in Yii framework which will understand the yii model rules, user defined functions. In yii rules function I added code (of yiiframework) for unique,email,password comparison, date, phone number, trim etc.

Default Validation

Compare Validation

Date/Time Validation

Email Validation

Unique Validation

Custom Function Validation

URL Validation

Range Validation

preg_match(pattern) Validation

File Validation

Required Validation

A sample model to implement in your web application


About: Prem Tiwari

Prem Tiwari is the founder of freewebmentor.com and is a professional developer who has vast experience in PHP and open source technologies. Apart from this, he is a blogger by hobby and also he has been a regular speaker of WordPress sessions in various IT Companies.


You may also like:


,