承接 service-to/validate-email 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

service-to/validate-email

最新稳定版本:1.0.11

Composer 安装命令:

composer require service-to/validate-email

包简介

Library to validate an email address against its mail servers by doing a name server lookup and then connecting to its MX records.

README 文档

README

Library to validate an email address against its mail servers by doing a name server lookup and then connecting to its MX records.

Tired of those pesky fake email addresses in your submission forms?

Add this little bit of majesty to your form validation rules and your server will connect to the MX records and test the validity of the address the user has entered.

It typically only takes a moment to validate a working address and when an invalid address is entered it takes longer, which can be a win, slowing down annoying script kiddies.

Usage

Install using composer...

composer require "service-to/validate-email"

In a Laravel Controller

use ServiceTo\ValidateEmail;

public function store(Request $request) {
	$validateemail = new ValidateEmail;
	try {
		if (!$validateemail->test($request->input("email"))) {
			return redirect()->back()->withErrors(["email" => "Invalid Email Address"])
		}
	}
	catch (\ServiceTo\ValidateEmailException $vee) {
		return redirect()->back()->withErrors(["email" => "Invalid Email Address (" . $vee->getMessage() . ")"])
	}

	// rest of checks...
}

In plain old PHP

require_once("vendor/autoload.php");
use ServiceTo\ValidateEmail;

$errors = array();
$validateemail = new ValidateEmail;
try {
	if (!$validateemail->test($_REQUEST["email"])) {
		$errors["email"] = "Invalid Email Address";
	}
}
catch (ServiceTo\ValidateEmailException $vee) {
	$errors["email"] = "Invalid Email Address (" . $vee->getMessage() . ")";
}

if (count($errors) > 0) {
	// don't move on from here, give the user back some errors...
	header("Content-type: application/json");
	echo(json_encode(array("response" => "error", "errors" => $errors)));
	exit();
}

统计信息

  • 总下载量: 1.29k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 3
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-06-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固