Download the PHP package pyzit/tempmail without Composer
On this page you can find all versions of the php package pyzit/tempmail. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pyzit/tempmail
More information about pyzit/tempmail
Files in pyzit/tempmail
Package tempmail
Short Description Official PHP SDK for the Pyzit disposable email detector API
License MIT
Homepage https://temp-mail-detector.pyzit.com
Informations about the package tempmail
pyzit/tempmail — PHP SDK
Official PHP client for the Pyzit Disposable Email Detector API. Detect throwaway and temporary email addresses before they reach your database.
Table of Contents
- Requirements
- Installation
- Quick Start
- Authentication
- Methods
- check()
- detailed()
- bulk()
- Response Models
- Error Handling
- Framework Integration
- Configuration
- Testing
- Project Structure
Requirements
| Requirement | Version |
|---|---|
| PHP | ≥ 8.1 |
| ext-curl | any |
| ext-json | any |
No other runtime dependencies.
Installation
Quick Start
Get your API token from the Pyzit dashboard.
Authentication
Pass your API token as the first argument to TempMailClient:
Keep your token secret. The recommended approach is to load it from an environment variable:
Methods
check() — Free Tier
Quick disposable check. Returns in milliseconds.
Parameters
| Name | Type | Description |
|---|---|---|
$email |
string |
The email address to check |
Returns CheckResult
detailed() — Pro Tier
Full DNS, reputation, and signal analysis. Use this when you need to know why an email is suspicious — not just that it is.
Parameters
| Name | Type | Description |
|---|---|---|
$email |
string |
The email address to analyse |
Returns DetailedResult
Requires the Pro plan. Throws
PlanRequiredExceptionif your account does not have access.
bulk() — Business Tier
Validate up to 100 emails in a single API call. Far more efficient than looping check().
Parameters
| Name | Type | Description |
|---|---|---|
$emails |
string[] |
Array of email addresses (max 100) |
Returns BulkResult
Requires the Business plan. Throws
PlanRequiredExceptionif your account does not have access.
Response Models
All models are immutable value objects with readonly properties. There is no JSON decoding to do — the SDK handles it.
CheckResult
Returned by check().
| Property | Type | Description |
|---|---|---|
$email |
string |
The email address that was validated |
$isDisposable |
bool |
true if the email is disposable |
$status |
string |
"clean" or "disposable" |
Methods
| Method | Returns | Description |
|---|---|---|
isClean() |
bool |
Convenience: !$this->isDisposable |
DetailedResult
Returned by detailed().
| Property | Type | Description |
|---|---|---|
$email |
string |
The email address |
$domain |
string |
The domain portion |
$isDisposable |
bool |
Whether the email is disposable |
$status |
string |
"clean" or "disposable" |
$reputationScore |
float |
0.0 (bad) to 1.0 (trusted) |
$riskLevel |
string |
"low", "medium", or "high" |
$recommendation |
string |
"accept", "review", or "reject" |
$details |
DetailedDetails |
Nested analysis object |
Methods
| Method | Returns | Description |
|---|---|---|
shouldReject() |
bool |
true when recommendation === "reject" |
DetailedDetails
Accessible via $result->details.
| Property | Type | Description |
|---|---|---|
$reputation |
ReputationDetail |
Reputation scoring |
$signals |
Signals |
Positive / negative signals |
$dnsIntelligence |
DnsIntelligence |
DNS record analysis |
$stability |
StabilityInfo |
Domain age and stability |
DnsIntelligence
| Property | Type | Description |
|---|---|---|
$hasMx |
bool |
Domain has MX records |
$mxRecords |
MxRecord[] |
Array of MX record objects |
$hasARecord |
bool |
Domain has an A record |
$hasSpf |
bool |
Domain has an SPF record |
$hasDmarc |
bool |
Domain has a DMARC record |
$error |
?string |
DNS lookup error message, or null |
MxRecord
| Property | Type | Description |
|---|---|---|
$priority |
int |
MX priority (lower = higher priority) |
$exchange |
string |
Mail exchange hostname |
$ips |
string[] |
Resolved IP addresses for this host |
Signals
| Property | Type | Description |
|---|---|---|
$positive |
string[] |
Signals that lower risk |
$negative |
string[] |
Signals that increase risk |
$neutral |
string[] |
Informational signals |
ReputationDetail
| Property | Type | Description |
|---|---|---|
$reputationScore |
float |
0.0 – 1.0 reputation score |
$isDisposable |
bool |
Whether classified as disposable |
$disposableConfidence |
float |
Confidence in the classification |
$riskLevel |
string |
"low", "medium", or "high" |
$recommendation |
string |
"accept", "review", "reject" |
StabilityInfo
| Property | Type | Description |
|---|---|---|
$stabilityScore |
float |
0.0 – 1.0 domain stability score |
$domainAgeDays |
int |
Age of the domain in days |
$isNewDomain |
bool |
true if the domain is newly seen |
$riskFactors |
string[] |
Risk factor identifiers |
BulkResult
Returned by bulk().
| Property | Type | Description |
|---|---|---|
$results |
array<string, bool> |
Map of email address → is_disposable |
$processed |
int |
Number of emails processed |
Methods
| Method | Returns | Description |
|---|---|---|
disposableEmails() |
string[] |
Only the disposable email addresses |
cleanEmails() |
string[] |
Only the clean email addresses |
Error Handling
All exceptions extend PyzitException, so you can catch everything in one block or handle specific cases:
Exception Reference
| Exception | HTTP Status | Attribute |
|---|---|---|
AuthenticationException |
401 | — |
ScopeException |
403 (scope) | getRequiredScope(): string |
PlanRequiredException |
402 / 403 | getRequiredPlan(): string |
RateLimitException |
429 | getRetryAfter(): int (seconds) |
ApiException |
5xx / other | getStatusCode(): int, getResponseBody(): string |
TimeoutException |
— | — |
All of the above extend PyzitException which extends \RuntimeException.
Fail-Open Pattern
Never block a legitimate user because your email validation API is temporarily down. Always fail open on SDK errors:
Framework Integration
Laravel
Service Provider binding:
Middleware:
Form Request validation rule:
Symfony
Service configuration (config/services.yaml):
Validator Constraint:
Plain PHP
Configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
$apiToken |
string |
— | Your Pyzit API token |
$timeout |
int |
10 |
cURL timeout in seconds |
$baseUrl |
string |
https://api-tempmail.pyzit.com/v1 |
API base URL |
Testing
Running the test suite
Output:
Testing your own code
The SDK is designed to be testable. In your own tests, inject a fake or mock TempMailClient rather than making real API calls.
Using a hand-rolled fake:
Using PHPUnit mocks:
Project Structure
API Reference
Full API documentation: https://temp-mail-detector.pyzit.com/docs
| Endpoint | Method | Plan | SDK method |
|---|---|---|---|
/v1/validate/check/ |
POST | Free | check() |
/v1/validate/detailed/ |
POST | Pro | detailed() |
/v1/validate/bulk/ |
POST | Business | bulk() |
License
MIT — see LICENSE for details.
Support
- Documentation: https://temp-mail-detector.pyzit.com/docs
- Email: [email protected]
- Issues: GitHub Issues
Docker (Recommended)
Docker is the recommended way to work with this SDK. It pins PHP and Composer to exact versions, so the project runs identically on any machine — your laptop, a new PC, a CI server, or a teammate's computer. No PHP or Composer installation is needed on the host.
Prerequisites
- Docker Desktop (Windows / Mac) or Docker Engine (Linux)
- PowerShell (Windows comes with it preinstalled)
First-time setup
Daily workflow
All available commands
| Command | What it does |
|---|---|
.\dev.ps1 install |
Build image + install Composer dependencies |
.\dev.ps1 test |
Run all PHPUnit tests |
.\dev.ps1 test-filter -Filter FooTest |
Run only tests matching FooTest |
.\dev.ps1 shell |
Open interactive bash shell inside container |
.\dev.ps1 example |
Run example_usage.php |
.\dev.ps1 build |
Rebuild the Docker image |
.\dev.ps1 clean |
Remove containers, volumes, and image |
.\dev.ps1 help |
Show all available commands |
Running Docker commands manually
If you prefer raw Docker commands instead of dev.ps1:
Moving to a new machine
The Docker image pins PHP 8.3 and Composer 2.7. To upgrade PHP, change the FROM line in the Dockerfile.
All versions of tempmail with dependencies
ext-curl Version *
ext-json Version *