PHPackages                             zemailme/zemail-php - 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. zemailme/zemail-php

ActiveLibrary

zemailme/zemail-php
===================

The official PHP SDK for Zemail Developer API.

v1.0.0(yesterday)060↑600%1MITPHPPHP ^8.2CI passing

Since Aug 16Pushed yesterdayCompare

[ Source](https://github.com/zemailme/zemail-php)[ Packagist](https://packagist.org/packages/zemailme/zemail-php)[ Docs](https://zemail.me)[ RSS](/packages/zemailme-zemail-php/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

Zemail PHP SDK
==============

[](#zemail-php-sdk)

[![Latest Version on Packagist](https://camo.githubusercontent.com/2fd5df931ef0194e3179c77a4a0d40d6bcff81be8cefe8b938c0cc05dbd4d578/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7a656d61696c6d652f7a656d61696c2d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/zemailme/zemail-php)[![GitHub Tests Action Status](https://camo.githubusercontent.com/5d4d98ab7fb01998c6b2183eedeed94c7eaeec94611373fcb404b4b6883474bf/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7a656d61696c6d652f7a656d61696c2d7068702f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/zemailme/zemail-php/actions?query=workflow%3ATests+branch%3Amain)[![PHP Version](https://camo.githubusercontent.com/fb4703a418c21976903221a798ca96c14fc216197a915974870c4ece362600f1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7a656d61696c6d652f7a656d61696c2d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/zemailme/zemail-php)[![License](https://camo.githubusercontent.com/918a65f2a60bdf0e520802fe6eec375f1c50509eacf05cdb28372564d660a180/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f7a656d61696c6d652f7a656d61696c2d7068703f7374796c653d666c61742d737175617265)](https://github.com/zemailme/zemail-php/blob/main/LICENSE)

The official PHP SDK for the [Zemail Developer API](https://zemail.me/api-docs). Create and manage temporary mailboxes, receive emails, and handle attachments programmatically.

---

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- Guzzle HTTP client (`guzzlehttp/guzzle: ^7.8`)
- `ext-json`

---

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

[](#installation)

Install the package via Composer:

```
composer require zemailme/zemail-php
```

---

Quickstart
----------

[](#quickstart)

Initialize the `Client` with your API key:

```
use Zemail\Client;

$client = new Client('zm_live_your_api_key_here');
```

You can optionally specify an API version or custom Guzzle client options (e.g. timeout):

```
$client = new Client(
    apiKey: 'zm_live_your_api_key_here',
    version: '2026-04-23',
    guzzleOptions: [
        'timeout' => 10.0,
        'headers' => [
            'X-Custom-Header' => 'value',
        ],
    ]
);
```

---

Usage
-----

[](#usage)

### 1. Account &amp; Subscription

[](#1-account--subscription)

Access your account profile, active plan, and API/mailbox usage limits:

```
// Get account profile
$account = $client->account()->get();
echo "Account ID: {$account->id}, Email: {$account->email}, Tier: {$account->tier}\n";

// Get active subscription
$subscription = $client->account()->subscription();
echo "Status: {$subscription->status}, Tier: {$subscription->tier}\n";

// Get current resource & API usage
$usage = $client->account()->usage();
print_r($usage->mailboxes);
print_r($usage->storage);
print_r($usage->developerApi);
```

---

### 2. Domains

[](#2-domains)

List available domains for mailbox creation:

```
$domains = $client->domains()->list();

foreach ($domains->data as $domain) {
    echo "Domain: {$domain->name} (Types: " . implode(', ', $domain->allowedTypes) . ")\n";
}
```

---

### 3. Mailboxes

[](#3-mailboxes)

#### List Mailboxes

[](#list-mailboxes)

```
$mailboxes = $client->mailboxes()->list(page: 1, limit: 10);

foreach ($mailboxes->data as $mailbox) {
    echo "Mailbox: {$mailbox->address} (ID: {$mailbox->id})\n";
}

if ($mailboxes->hasMore) {
    echo "Next cursor: {$mailboxes->nextCursor}\n";
}
```

#### Create a Random Mailbox

[](#create-a-random-mailbox)

```
$mailbox = $client->mailboxes()->create([
    'type' => 'random',
]);

echo "Created random mailbox: {$mailbox->address}\n";
```

#### Create a Custom Mailbox

[](#create-a-custom-mailbox)

```
$mailbox = $client->mailboxes()->create([
    'type' => 'custom',
    'domain' => 'zemail.me',
    'username' => 'my-inbox',
]);

echo "Created custom mailbox: {$mailbox->address}\n";
```

#### Get Mailbox Details

[](#get-mailbox-details)

```
$mailbox = $client->mailboxes()->get(123);
echo "Address: {$mailbox->address}, Unread emails: {$mailbox->unreadCount}\n";
```

#### Delete a Mailbox

[](#delete-a-mailbox)

```
$deleted = $client->mailboxes()->delete(123);
// Returns true on success
```

---

### 4. Emails &amp; Attachments

[](#4-emails--attachments)

#### List Emails in a Mailbox

[](#list-emails-in-a-mailbox)

```
// List recent emails with optional search query
$emails = $client->mailboxes()->emails()->list(
    mailboxId: $mailbox->id,
    page: 1,
    limit: 25,
    search: 'verification'
);

foreach ($emails->data as $email) {
    echo "[{$email->id}] From: {$email->sender} | Subject: {$email->subject}\n";
}
```

#### Get Full Email Details

[](#get-full-email-details)

```
$email = $client->mailboxes()->emails()->get($mailbox->id, $emailId);

echo "Subject: {$email->subject}\n";
echo "Plain text body: {$email->bodyText}\n";
echo "HTML body: {$email->bodyHtml}\n";

// Inspect attachments
foreach ($email->attachments as $attachment) {
    echo "Attachment: {$attachment->name} ({$attachment->size} bytes)\n";
}
```

#### Mark Email as Read

[](#mark-email-as-read)

```
$isRead = $client->mailboxes()->emails()->markAsRead($mailbox->id, $emailId);
```

#### Get Temporary Attachment Download URL

[](#get-temporary-attachment-download-url)

```
$download = $client->mailboxes()->emails()->getAttachmentDownloadUrl(
    mailboxId: $mailbox->id,
    emailId: $emailId,
    attachmentId: 'att_123'
);

echo "Download URL: {$download['url']}\n";
echo "Expires at: {$download['expires_at']}\n";
```

#### Delete an Email

[](#delete-an-email)

```
$deleted = $client->mailboxes()->emails()->delete($mailbox->id, $emailId);
// Returns true on success
```

---

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

[](#error-handling)

All SDK exceptions inherit from `Zemail\Exceptions\ZemailException`:

ExceptionHTTP StatusDescription`AuthenticationException``401`, `403`Invalid API key or unauthorized access`NotFoundException``404`Resource (mailbox, email, domain) not found`ValidationException``422`Request validation failure (includes `$e->errors`)`RateLimitException``429`Daily or concurrency rate limit reached`ZemailException`AnyGeneric SDK/API exception```
use Zemail\Exceptions\AuthenticationException;
use Zemail\Exceptions\NotFoundException;
use Zemail\Exceptions\RateLimitException;
use Zemail\Exceptions\ValidationException;
use Zemail\Exceptions\ZemailException;

try {
    $mailbox = $client->mailboxes()->create(['type' => 'custom']);
} catch (ValidationException $e) {
    echo "Validation failed: " . $e->getMessage() . "\n";
    print_r($e->errors);
} catch (AuthenticationException $e) {
    echo "Auth error: " . $e->getMessage() . "\n";
} catch (RateLimitException $e) {
    echo "Rate limited: " . $e->getMessage() . "\n";
} catch (NotFoundException $e) {
    echo "Not found: " . $e->getMessage() . "\n";
} catch (ZemailException $e) {
    echo "General error: " . $e->getMessage() . "\n";
}
```

---

Development &amp; Testing
-------------------------

[](#development--testing)

Run unit &amp; feature tests with Pest:

```
composer test
```

Run static analysis with PHPStan:

```
composer test:types
```

Format code with Laravel Pint:

```
composer format
```

---

License
-------

[](#license)

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

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance100

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80% 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

1d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/22aa68adfce3247546f94e98803f0786bf717b21780eebe651479b5d05cf00af?d=identicon)[zemailme](/maintainers/zemailme)

---

Top Contributors

[![idevakk](https://avatars.githubusercontent.com/u/219866223?v=4)](https://github.com/idevakk "idevakk (8 commits)")[![zemailme](https://avatars.githubusercontent.com/u/317541568?v=4)](https://github.com/zemailme "zemailme (2 commits)")

---

Tags

php-sdktemp-mailtemp-mail-apizemailzemail-apizemail-sdkphp-sdktemporary emaildisposable-emailemail-apitemp-mailzemail

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/zemailme-zemail-php/health.svg)

```
[![Health](https://phpackages.com/badges/zemailme-zemail-php/health.svg)](https://phpackages.com/packages/zemailme-zemail-php)
```

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.2k555.0M2.8k](/packages/aws-aws-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k832.6k54](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3661.3M49](/packages/tencentcloud-tencentcloud-sdk-php)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

353.6k](/packages/eslazarev-wildberries-sdk)[tempest/framework

The PHP framework that gets out of your way.

2.3k37.6k21](/packages/tempest-framework)[files.com/files-php-sdk

Files.com PHP SDK

2482.9k](/packages/filescom-files-php-sdk)

PHPackages © 2026

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