承接 usercheck/usercheck-laravel 相关项目开发

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

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

usercheck/usercheck-laravel

Composer 安装命令:

composer require usercheck/usercheck-laravel

包简介

Laravel validation rule for UserCheck API

README 文档

README

Latest Stable Version Total Downloads License Tests Status

A Laravel package for validating email addresses using the UserCheck.com API.

✨ Features

  • Block disposable email addresses with an always up-to-date API
  • Block public email domains (Gmail, Yahoo, etc.) to require business addresses
  • Block email forwarding/relay services
  • Block domains marked as spam
  • Block custom domains from your own blocklist (paid plans only)
  • Check for missing MX records
  • Validate by domain only for privacy — never sends the local part of the email to the API
  • Use as a string rule ('usercheck:block_disposable'), an object rule, or via the UserCheck facade directly
  • Localization support for all error messages

Requirements

  • PHP 8.2+
  • Laravel 11, 12, or 13

Installation

Install the package via Composer:

composer require usercheck/usercheck-laravel

Configuration

Add your UserCheck API key to your .env file:

USERCHECK_API_KEY=your_api_key_here

You can obtain a free API key by signing up at https://app.usercheck.com/register.

Usage

Use the usercheck rule in your Laravel validation:

$request->validate([
    'email' => 'required|email|usercheck'
]);

Options

By default, the usercheck rule will only validate the email address's syntax using the UserCheck API. If the email is invalid, the validation will fail.

The usercheck rule accepts several parameters:

  • block_disposable: Fails validation if the email is from a disposable email provider
  • block_no_mx: Fails validation if the domain has no MX records
  • block_public_domain: Fails validation for public email domains (e.g., Gmail, Yahoo). Great to prevent users from signing up with their personal email addresses.
  • block_relay_domain: Blocks email addresses from email forwarding services
  • block_spam: Blocks email addresses from domains that have been marked as spam
  • domain_only: Validates only the domain part of the email. Great for privacy; only the domain will be sent to the API.
  • block_blocklisted: (Paid plans only) Blocks domains from your custom blocklist.

You can combine these options to create a custom validation rule:

$request->validate([
    'email' => 'required|email|usercheck:domain_only,block_disposable,block_no_mx,block_spam',
]);

Using the Facade

You can also use the UserCheck facade directly:

use UserCheck\Laravel\Facades\UserCheck;
$result = UserCheck::validateEmail('test@example.com');
$result = UserCheck::validateDomain('example.com');

Both methods return an array with is_valid and error_code keys.

Localization

The package includes English translations by default. To customize the error messages, publish the language files:

php artisan vendor:publish --provider="UserCheck\Laravel\UserCheckProvider" --tag="lang"

Then, edit the files in resources/lang/vendor/usercheck.

Testing

Run the tests with:

composer test

Mutation testing

Mutation testing is configured via Pest 4 and can be run with:

composer mutate

This requires a code coverage driver (Xdebug or PCOV) to be loaded.

Contributing

Contributions are welcome! Open an issue or pull request on GitHub.

Security

If you discover any security-related issues, please email security@usercheck.com instead of using the issue tracker.

License

The MIT License (MIT). Please see License File for more information.

Support

For support, please email support@usercheck.com or open an issue on GitHub.

usercheck/usercheck-laravel 适用场景与选型建议

usercheck/usercheck-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6.19k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2024 年 09 月 23 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「email」 「validation」 「laravel」 「disposable」 「usercheck」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 usercheck/usercheck-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 usercheck/usercheck-laravel 我们能提供哪些服务?
定制开发 / 二次开发

基于 usercheck/usercheck-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-09-23