Coder Social home page Coder Social logo

mailboxvalidator / mailboxvalidator-cakephp Goto Github PK

View Code? Open in Web Editor NEW
3.0 4.0 0.0 10 KB

MailboxValidator CakePHP package enable users to block disposal email, detect free email and validate if an email is valid

Home Page: https://www.mailboxvalidator.com

License: MIT License

PHP 100.00%
mailboxvalidator-cakephp mailboxvalidator-api cakephp cakephp-plugin cake-plugin email-validation email-validator email-verification email-verifier

mailboxvalidator-cakephp's Introduction

MailboxValidator CakePHP Email Validation Package

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
100 Missing parameter.
101 API key not found.
102 API key disabled.
103 API key expired.
104 Insufficient credits.
105 Unknown error.

Copyright

Copyright (C) 2018-2024 by MailboxValidator.com, [email protected]

mailboxvalidator-cakephp's People

Contributors

mailboxvalidator avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.