定制 mailboxvalidator/mailboxvalidator-cakephp 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

mailboxvalidator/mailboxvalidator-cakephp

Composer 安装命令:

composer require mailboxvalidator/mailboxvalidator-cakephp

包简介

MailboxValidator plugin for CakePHP

README 文档

README

MailboxValidator CakePHP Email Validation Package enables user to easily validate if an email address is valid, a type of disposable email or free email.

This package can be useful in many types of projects, for example

  • to validate an user's email during sign up
  • to clean your mailing list prior to email sending
  • to perform fraud check
  • and so on

Installation

Open the terminal, locate to your project root and run the following command :

composer require mailboxvalidator/mailboxvalidator-cakephp

If you want to manually install this plugin, firstly clone the plugin folder to the plugins folder under your website project. After that, add the following line into your project's composer.json file like this:

{
    ....
    "autoload": {
        "psr-4": {
            ....
            "MailboxValidatorCakePHP\\": "plugins/mailboxvalidator-cakephp/src/"
        }
    },
}

Remember to run this command to autoload our plugin:

composer dumpautoload

Dependencies

An API key is required for this module to function.

Go to https://www.mailboxvalidator.com/plans#api to sign up for FREE API plan and you'll be given an API key.

After you get your API key, open your config/bootstrap.php and add the following line:

Configure::write('MBV_API_KEY','PASTE_YOUR_API_KEY_HERE');

Functions

single (email_address)

Performs email validation on the supplied email address.

disposable (email_address)

Check if the supplied email address is from a disposable email provider.

free (email_address)

Check if the supplied email address is from a free email provider.

Usage

Include this line in any form controller that handle validation:

use MailboxValidatorCakePHP\Controller\MailboxValidatorController;

In any form validation method, before the $validator declare this line:

$MBV = new MailboxValidatorController();

Add the below line right after the $validator:

->setProvider('mbv', $MBV)

After that, add a new rule to your form field. For example, if you want to validate the disposable email, your rule will be like this:

->add('email', 'disposable', [
        'rule' => 'disposable',
        'provider' => 'mbv',
        'message' => 'Invalid email address. Please enter a non-disposable email address.',
])

The validators available to validate the email are: single, free and disposable. Each validator validate the email by using MailboxValidator API. For more information, you can visit Single Validation API, Disposable Email API and Free Email API.

Errors

error_code error_message
10000 Missing parameter.
10001 API key not found.
10002 API key disabled.
10003 API key expired.
10004 Insufficient credits.
10005 Unknown error.

Copyright

Copyright (C) 2018-2026 by MailboxValidator.com, support@mailboxvalidator.com

统计信息

  • 总下载量: 14
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-11-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固