This repository has been archived on 2025-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
drupalcampbristol/core/vendor/egulias/email-validator
2015-08-27 12:03:05 -07:00
..
documentation Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542 2015-08-27 12:03:05 -07:00
src/Egulias/EmailValidator Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542 2015-08-27 12:03:05 -07:00
tests Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542 2015-08-27 12:03:05 -07:00
.coveralls.yml Drupal 8.0.0 beta 12. More info: https://www.drupal.org/node/2514176 2015-08-17 17:00:26 -07:00
.gitignore Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542 2015-08-27 12:03:05 -07:00
.travis.yml Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542 2015-08-27 12:03:05 -07:00
composer.json Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542 2015-08-27 12:03:05 -07:00
composer.lock Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542 2015-08-27 12:03:05 -07:00
LICENSE Drupal 8.0.0 beta 12. More info: https://www.drupal.org/node/2514176 2015-08-17 17:00:26 -07:00
phpunit.xml.dist Drupal 8.0.0 beta 12. More info: https://www.drupal.org/node/2514176 2015-08-17 17:00:26 -07:00
README.md Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542 2015-08-27 12:03:05 -07:00

#EmailValidator Build Status Coverage Status Scrutinizer Code Quality SensioLabsInsight

With the help of

Powered by PhpStorm ##Installation##

Run the command below to install via Composer

composer require egulias/email-validator

##Usage##

Simple example:

<?php

use Egulias\EmailValidator\EmailValidator;

$validator = new EmailValidator;
if ($validator->isValid($email)) {
	echo $email . ' is a valid email address';
}

More advanced example (returns detailed diagnostic error codes):

<?php

use Egulias\EmailValidator\EmailValidator;

$validator = new EmailValidator;
$email = 'dominic@sayers.cc';
$result = $validator->isValid($email);

if ($result) {
	echo $email . ' is a valid email address';
} else if ($validator->hasWarnings()) {
	echo 'Warning! ' . $email . ' has unusual/deprecated features (result code ' . var_export($validator->getWarnings(), true) . ')';
} else {
	echo $email . ' is not a valid email address (result code ' . $validator->getError() . ')';
}

##Contributors## As this is a port from another library and work, here are other people related to the previous:

  • Ricard Clau @ricardclau: Performance against PHP built-in filter_var
  • Josepf Bielawski @stloyd: For its first re-work of Dominic's lib
  • Dominic Sayers @dominicsayers: The original isemail function

##License## Released under the MIT License attached with this code.