I am trying to validate email while registration to makesure no spam. For that purpose i learn that, Zend FrameWork is good for this.
So to try that following steps i followed:
- i downloaded ZendFramework-2.4.13.zip from https://framework.zend.com/downloads/archives
- I extract in the same path of my file and rename folder to ZendFramework
- Then i try following code, as guided in their tutorial.
require_once("ZendFramework/library/Zend/Validator/EmailAddress.php");
$validator = new Zend\Validator\EmailAddress();
$email = "[email protected]";
if ($validator->isValid($email)) {
echo "Valid \n";
} else {
// email is invalid; print the reasons
foreach ($validator->getMessages() as $message) {
echo "$message\n";
}
}
But when i am running code, i got following error, i even checked the zend source class, but it seems normal.
PHP Fatal error: Uncaught Error: Class 'Zend\Validator\AbstractValidator' not found in /home/account_name/public_html/test_mail/ZendFramework/library/Zend/Validator/EmailAddress.php:12
Stack trace: #0 /home/account_name/public_html/test_mail/email-test.php(2): require_once()
#1 {main} thrown in /home/account_name/public_html/test_mail/ZendFramework/library/Zend/Validator/EmailAddress.php on line 12
Need experts help, what i am doing wrong, do i need to only call it by extending class?
Update I also tried following, but still same error
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . '/home/account_name/public_html/test_mail/ZendFramework/library/');
require_once("Zend/Validator/EmailAddress.php");