PHPackages                             mjk-limon/temporary-email-checker - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mjk-limon/temporary-email-checker

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mjk-limon/temporary-email-checker
=================================

A simple temporary email checker for php

v1.0.0(3mo ago)011MITPHP

Since Apr 18Pushed 3mo agoCompare

[ Source](https://github.com/mjk-limon/temporary-email-checker-php)[ Packagist](https://packagist.org/packages/mjk-limon/temporary-email-checker)[ RSS](/packages/mjk-limon-temporary-email-checker/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Temporary (Spam) Email Checker
==============================

[](#temporary-spam-email-checker)

A PHP service that validates email domains against whitelist and blacklist, with automatic disposable domain detection using our known database and UserCheck API.

Features
--------

[](#features)

- ✅ **Whitelist Checking** - Quick validation against legitimate domains
- ✅ **Blacklist Checking** - Prevents known disposable/spam domains
- ✅ **API Integration** - Automatic disposable domain detection via UserCheck API
- ✅ **Smart Caching** - Automatically maintained whitelist and blacklist
- ✅ **File-Based Storage** - No database required, simple file management
- ✅ **Indexed Cache** - Ultra-fast lookups using indexed cache files by domain prefix

Cache System
------------

[](#cache-system)

The system uses **indexed cache files** for ultra-fast domain lookups:

### How It Works

[](#how-it-works)

- **Master files** (`data/white.list`, `data/black.list`) contain your source data and remain unchanged
- **Cache files** (`.cache/whitelist-*.list`, `.cache/blacklist-*.list`) are used for runtime lookups
- **Indexing by prefix** - Domains are stored in separate files based on their first character:
    - `whitelist-a.list` → domains starting with 'a'
    - `whitelist-b.list` → domains starting with 'b'
    - ... continue for all 26 letters
    - `whitelist-others.list` → domains starting with numbers 0-9

### Benefits

[](#benefits)

- ✅ **Faster lookups** - Search only in relevant cache file
- ✅ **Original data safe** - Master files never modified
- ✅ **Easy management** - New domains appended only to cache
- ✅ **Minimal memory** - Load only relevant portions

### Initial Setup

[](#initial-setup)

Before first use, build the cache from your master data files:

```
php configure.php
```

This command:

1. Reads `data/white.list` and `data/black.list`
2. Creates indexed cache files in `.cache/` folder
3. Removes duplicates and sorts domains
4. Displays statistics

**Sample output:**

```
========================================
Building Cache Configuration
========================================

Building WHITELIST cache from /var/www/data/white.list...
Created cache: /var/www/.cache/whitelist-g.list (50 domains)
Created cache: /var/www/.cache/whitelist-y.list (75 domains)
Total domains in whitelist: 5000

Building BLACKLIST cache from /var/www/data/black.list...
Created cache: /var/www/.cache/blacklist-0.list (200 domains)
Created cache: /var/www/.cache/blacklist-d.list (450 domains)
Total domains in blacklist: 50000

========================================
✓ Cache configuration completed successfully!

```

### Verify Cache

[](#verify-cache)

Check cache integrity anytime:

```
# Command line
php configure.php verify
```

### Rebuild Cache

[](#rebuild-cache)

When you manually update `data/white.list` or `data/black.list`, rebuild the cache:

```
php configure.php
```

### How New Domains Are Stored

[](#how-new-domains-are-stored)

When a new domain is validated via the API:

- It's **appended to the cache file** (not the master file)
- Organized by its first character automatically
- Master `data/white.list` and `data/black.list` remain unchanged
- Next `configure.php` run will consolidate cache back to master files if needed
- PHP 7.4+
- file\_get\_contents with stream context support
- Write permissions for list files

Installation
------------

[](#installation)

1. Clone or download the files to your web directory:

```
cd /var/www/html/services-my/spam-email-checker
```

2. Set permission to .cache directory:

```
chmod 755 .cache
```

3. Add your master domain lists to `data/`:

```
# Create or add your domains
echo "gmail.com" >> data/white.list
echo "yahoo.com" >> data/white.list

echo "0-mail.com" >> data/black.list
```

4. Build the cache (IMPORTANT!):

```
php configure.php
```

5. Set proper permissions:

```
chmod 644 index.php configure.php README.md
chmod 755 data .cache
chmod 644 data/*.list .cache/*.list
```

6. Update the API key in `index.php`:

```
$userCheckApiKey = 'your-usercheck-api-key-here';
```

Configuration
-------------

[](#configuration)

### API Key

[](#api-key)

Get your UserCheck API key from [usercheck.com](https://usercheck.com) and add it to `index.php`:

```
$userCheckApiKey = 'prd_YourApiKeyHere';
```

### Cache Directory

[](#cache-directory)

Cache files are stored in `.cache/` folder. Ensure it's writable:

```
chmod 755 .cache
```

### Master Data Files

[](#master-data-files)

Keep your master lists in `data/` folder:

```
data/white.list  # Original whitelist (unchanged by the service)
data/black.list  # Original blacklist (unchanged by the service)
```

API Usage
---------

[](#api-usage)

### Check Email Domain

[](#check-email-domain)

**Request:**

```
curl -X POST https://my-spam-filter.local/index.php \
  -d "email=user@example.com"
```

Workflow
--------

[](#workflow)

The service follows this logic:

1. **Extract Domain** - Gets domain from email address
2. **Check Whitelist Cache** - Returns `true` if found in `whitelist-*.list` cache
3. **Check Blacklist Cache** - Returns `false` if found in `blacklist-*.list` cache
4. **API Check** - Calls UserCheck API to detect disposable domains:
    - If disposable → **Appends to** `blacklist-*.list` cache → Returns `false`
    - If legitimate → **Appends to** `whitelist-*.list` cache → Returns `true`

**Important:** Master files (`data/white.list`, `data/black.list`) are never modified. New domains are only added to cache files.

List File Format
----------------

[](#list-file-format)

Both `white.list` and `black.list` are plain text files with one domain per line:

```
gmail.com
yahoo.com
outlook.com
company.com

```

### Initial Whitelist

[](#initial-whitelist)

```
gmail.com
yahoo.com
ymail.com
prothomalo.com

```

### Blacklist Examples

[](#blacklist-examples)

```
0-30-24.com
0-mail.com
00.pe
00082cc.com

```

Error Handling
--------------

[](#error-handling)

The service throws exceptions for:

- Invalid email format
- API call failures
- Blacklisted domains

Handle exceptions in your integration:

```
try {
    $isValid = checkEmailDomain($email);
} catch (Exception $e) {
    echo "Error: " . $e->getMessage();
}
```

UserCheck API
-------------

[](#usercheck-api)

The service integrates with [UserCheck](https://usercheck.com) API to verify disposable domains.

**API Endpoint:** `https://api.usercheck.com/domain/{domain}`

**Headers:** `Authorization: Bearer {api_key}`

**Response:**

```
{
  "disposable": false,
  "domain": "example.com"
}
```

License
-------

[](#license)

MIT License - Feel free to use and modify

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance82

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

98d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/43162434?v=4)[Jahid Limon](/maintainers/mjk-limon)[@mjk-limon](https://github.com/mjk-limon)

---

Top Contributors

[![mjk-limon](https://avatars.githubusercontent.com/u/43162434?v=4)](https://github.com/mjk-limon "mjk-limon (5 commits)")

### Embed Badge

![Health badge](/badges/mjk-limon-temporary-email-checker/health.svg)

```
[![Health](https://phpackages.com/badges/mjk-limon-temporary-email-checker/health.svg)](https://phpackages.com/packages/mjk-limon-temporary-email-checker)
```

###  Alternatives

[roave/backward-compatibility-check

Tool to compare two revisions of a public API to check for BC breaks

6003.7M149](/packages/roave-backward-compatibility-check)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
