romanzipp/laravel-mailcheck 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

romanzipp/laravel-mailcheck

最新稳定版本:2.0.2

Composer 安装命令:

composer require romanzipp/laravel-mailcheck

包简介

A Laravel Wrapper for the MailCheck.ai disposable email API

README 文档

README

Latest Stable Version Total Downloads License GitHub Build Status

A Laravel Wrapper for the MailCheck.ai disposable email API made by @tompec.

✨ Migrating from Validator.Pizza

This package was previously called "Validator.Pizza". See the following guide if you want to migrate your previous installation.

Migration Guide

Package name

composer remove romanzipp/laravel-validator-pizza    
composer require romanzipp/laravel-mailcheck

Config file

Update the configuration file name.

- config/mailcheck.php
+ config/mailcheck.php

Code references

- romanzipp\ValidatorPizza\
+ romanzipp\MailCheck\

Rule

- 'email' => 'required|email|validator_pizza',
+ 'email' => 'required|email|disposable', 

Table name

The default new table name will be mailcheck_checks. If you want to keep the previous validator_pizza table name change the entry in your config file.

- validator_pizza
+ mailcheck_checks

Features

  • Query the MailCheck.ai API for disposable Emails & Domains
  • Cache responses
  • Store requested domains in database

Installation

composer require romanzipp/laravel-mailcheck

Configuration

Copy configuration to your project:

php artisan vendor:publish --provider="romanzipp\MailCheck\Providers\MailCheckProvider"

Run the migration:

php artisan migrate

Usage

Controller Validation

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class HomeController extends Controller
{
    public function handleEmail(Request $request)
    {
        $request->validate([
            'email' => 'required|email|disposable',
        ]);

        // ...
    }
}

Standalone

$checker = new \romanzipp\MailCheck\Checker;

// Validate domain
$validDomain = $checker->allowedDomain('ich.wtf');

// Validate mail address (uses domain check endpoint internally)
$validEmail = $checker->allowedEmail('ich@ich.wtf');

Advanced Usage

You can make your disposable checks more hard or loose by configuring the edge case behavior. There are 3 possible outcomes to set:

  • romanzipp\MailCheck\Enums\ApiIssue::ALLOW - allow the domain/mail
  • romanzipp\MailCheck\Enums\ApiIssue::DENY - deny the chekechecked domain/mail
  • romanzipp\MailCheck\Enums\ApiIssue::EXCEPTION - throw a DisposableMailException

Rate Limit exceeded

return [
    // ... 
    'decision_rate_limit' => \romanzipp\MailCheck\Enums\ApiIssue::EXCEPTION,
];

No MX DNS records present

There is no MX DNS entry present on the checked domain which means they can not receive any messages.

return [
    // ... 
    'decision_no_mx' => \romanzipp\MailCheck\Enums\ApiIssue::EXCEPTION,
];

Invalid request

return [
    // ... 
    'decision_invalid' => \romanzipp\MailCheck\Enums\ApiIssue::EXCEPTION,
];

统计信息

  • 总下载量: 4.86k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-09-25