PHP code example of salaros / is-biz-mail
1. Go to this page and download the library: Download salaros/is-biz-mail library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
salaros / is-biz-mail example snippets
alaros\Email\IsBizMail;
(new IsBizMail())->isValid('[email protected]'); // true
// You can use static access as well
IsBizMail::isValid('[email protected]'); // false
// ...
public function rules() {
return [
// ...
[['email'], 'isBusinessEmail'],
// ...
];
}
public function isBusinessEmail($attributeName, $params) {
$isBussiness = (new IsBizMail())->isValid($this->email);
if (!isBussiness)
$this->addError($attributeName, 'Mail boxes such as @gmail.com, @yahoo.com etc are not allowed!');
return $isBussiness;
}