PHPackages                             zone-webmail/wildduck-php-client - 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. [API Development](/categories/api)
4. /
5. zone-webmail/wildduck-php-client

ActiveLibrary[API Development](/categories/api)

zone-webmail/wildduck-php-client
================================

PHP client for Wildduck email server API

2.0.20(2w ago)75.7k3[1 PRs](https://github.com/zone-eu/zone-wildduck-php-client/pulls)EUPL-1.1PHPPHP ^8.3CI passing

Since Jun 16Pushed 2w ago3 watchersCompare

[ Source](https://github.com/zone-eu/zone-wildduck-php-client)[ Packagist](https://packagist.org/packages/zone-webmail/wildduck-php-client)[ RSS](/packages/zone-webmail-wildduck-php-client/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (10)Dependencies (21)Versions (52)Used By (0)

Wildduck API PHP Client
=======================

[](#wildduck-api-php-client)

A modern PHP client for the [Wildduck email server](https://github.com/nodemailer/wildduck) API with full type safety and DTO support.

[![PHP Version](https://camo.githubusercontent.com/c8d8dad6beb757a2b8acba331d16140813699543b88a37af0a81f20bd35f61de/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e332532422d626c7565)](https://php.net)[![License](https://camo.githubusercontent.com/ada26f80f14d07d534afb183a0489acf61443b969b927d74c281d0b64463bc20/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4555504c2d2d312e322d677265656e)](LICENSE)

Features
--------

[](#features)

- 🔒 **Type-Safe**: Full PHP 8.3+ type hints with strict types
- 📦 **DTOs**: Request and response Data Transfer Objects for IDE autocomplete
- 🎯 **Modern PHP**: Readonly properties, named parameters, union types
- 🔄 **EventSource**: Real-time updates via server-sent events
- 📚 **Comprehensive**: All 17 WildDuck API services covered

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

[](#requirements)

- PHP 8.3 or newer
- Composer

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

[](#installation)

```
composer require zone-eu/wildduck-php-client
```

Quick Start
-----------

[](#quick-start)

```
use Zone\Wildduck\WildduckClient;
use Zone\Wildduck\Dto\User\CreateUserDto;

// Initialize client
$client = new WildduckClient([
    'accessToken' => 'your-api-token',
    'apiUrl' => 'https://api.wildduck.email',
]);

// Create a user
$createDto = new CreateUserDto(
    username: 'john.doe',
    password: 'SecurePass123!',
    address: 'john.doe@example.com',
    name: 'John Doe'
);

$result = $client->users()->create($createDto);
echo "User created with ID: {$result->id}\n";

// Get user details
$user = $client->users()->get($result->id);
echo "Username: {$user->username}\n";
echo "Email: {$user->address}\n";

// Update user
$updateDto = new UpdateUserDto(
    name: 'John Updated Doe'
);
$client->users()->update($result->id, $updateDto);

// Delete user
$client->users()->delete($result->id);
```

Available Services
------------------

[](#available-services)

All services are accessed via the `WildduckClient` instance:

- `$client->users()` - User management
- `$client->addresses()` - Email address management
- `$client->mailboxes()` - Mailbox operations
- `$client->messages()` - Message handling
- `$client->filters()` - Email filters
- `$client->autoreply()` - Auto-reply settings
- `$client->applicationPasswords()` - App-specific passwords
- `$client->authentication()` - Authentication endpoints
- `$client->twoFactorAuthentication()` - 2FA management
- `$client->archive()` - Message archiving
- `$client->audit()` - Audit logs
- `$client->dkim()` - DKIM key management
- `$client->domainAliases()` - Domain alias operations
- `$client->events()` - Event streaming
- `$client->storage()` - File storage
- `$client->submission()` - Message submission
- `$client->webhooks()` - Webhook management

See [MIGRATION.md](MIGRATION.md) for complete migration guide from v1.x.

Examples
--------

[](#examples)

### Managing Messages

[](#managing-messages)

```
use Zone\Wildduck\Dto\Message\UploadMessageDto;

// Upload a message
$uploadDto = new UploadMessageDto(
    raw: base64_encode($emailSource),
    mailbox: $mailboxId
);

$result = $client->messages()->upload($userId, $mailboxId, $uploadDto);

// Search messages
$messages = $client->messages()->search($userId, [
    'q' => 'from:sender@example.com',
    'limit' => 10
]);

foreach ($messages->results as $message) {
    echo "Subject: {$message->subject}\n";
}
```

### Working with Filters

[](#working-with-filters)

```
use Zone\Wildduck\Dto\Filter\CreateFilterDto;
use Zone\Wildduck\Dto\Shared\FilterQueryDto;
use Zone\Wildduck\Dto\Shared\FilterActionDto;

$createDto = new CreateFilterDto(
    name: 'Spam Filter',
    query: new FilterQueryDto(from: 'spam@example.com'),
    action: new FilterActionDto(delete: true)
);

$client->filters()->create($userId, $createDto);
```

### Event Streaming

[](#event-streaming)

```
// Stream user mailbox updates
$response = $client->events()->forUser($userId);
// Returns StreamedResponse that can be processed with EventSource
```

Testing
-------

[](#testing)

The library includes comprehensive structure tests. See [TESTING.md](TESTING.md) for:

- Running tests
- Writing integration tests
- Test coverage information

```
# Run structure tests
vendor/bin/phpunit tests/Unit/Service/ServiceStructureTest.php
```

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

[](#configuration)

### Environment Variables

[](#environment-variables)

- `WDPC_REQUEST_LOGGING` (true/false) - Enable request logging
- `WDPC_REQUEST_LOGGING_FOLDER_PERMISSIONS` (0755) - Log folder permissions
- `WDPC_REQUEST_LOGGING_PATTERN` - RegEx for requests to log
- `WDPC_REQUEST_LOGGING_DIRECTORY` - Base directory for logs

### Client Options

[](#client-options)

```
$client = new WildduckClient([
    'accessToken' => 'your-token',       // Required
    'apiUrl' => 'https://api.example.com', // Optional
    'apiVersion' => 'v1',                 // Optional
    'httpClient' => $customClient,        // Optional custom HTTP client
]);
```

Architecture
------------

[](#architecture)

### DTOs (Data Transfer Objects)

[](#dtos-data-transfer-objects)

All requests and responses use strongly-typed DTOs:

```
// Request DTOs
use Zone\Wildduck\Dto\User\CreateUserDto;
use Zone\Wildduck\Dto\User\UpdateUserDto;

// Response DTOs
use Zone\Wildduck\Dto\User\UserDto;
use Zone\Wildduck\Dto\User\UserInfoDto;
use Zone\Wildduck\Dto\PaginatedResultDto;
```

DTOs provide:

- ✅ IDE autocomplete
- ✅ Type safety at compile time
- ✅ Clear API contracts
- ✅ Validation support

### Service Layer

[](#service-layer)

Services extend `AbstractService` and provide typed methods:

```
class UserService extends AbstractService
{
    public function create(CreateUserDto|null $params = null): UserInfoDto
    {
        return $this->requestDto('post', '/users', $params, UserInfoDto::class);
    }

    public function get(string $id): UserDto
    {
        return $this->requestDto('get', "/users/{$id}", null, UserDto::class);
    }
}
```

Upgrading from v1.x
-------------------

[](#upgrading-from-v1x)

See [MIGRATION.md](MIGRATION.md) for detailed upgrade instructions. Key changes:

1. **DTOs instead of arrays**: All requests now use DTOs
2. **Service access**: `$client->users()` instead of `$client->users`
3. **Return types**: Typed DTOs instead of generic arrays
4. **PHP 8.3+**: Modern PHP features throughout

Contributing
------------

[](#contributing)

Contributions are welcome! Please see our contributing guidelines:

1. Fork the repository
2. Create a feature branch
3. Add tests for new features
4. Ensure all tests pass
5. Submit a pull request

License
-------

[](#license)

[EUPL-1.2](LICENSE) - European Union Public License

Resources
---------

[](#resources)

- [WildDuck API Documentation](https://docs.wildduck.email/api/)
- [Migration Guide](MIGRATION.md)
- [Testing Guide](TESTING.md)
- [Changelog](CHANGELOG.md)

Credits
-------

[](#credits)

Heavily inspired by [stripe/stripe-php](https://github.com/stripe/stripe-php).

Made with ❤️ by [Zone Media OÜ](https://github.com/zone-eu)

###  Health Score

59

—

FairBetter than 99% of packages

Maintenance96

Actively maintained with recent releases

Popularity28

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

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

Every ~37 days

Recently: every ~5 days

Total

49

Last Release

18d ago

Major Versions

1.7.0 → 2.0.02026-01-22

PHP version history (4 changes)1.0.0PHP ^7.4|^8.0

1.2.7PHP ^7.4|^8.0|^8.1

1.4.0PHP ^8.1|^8.2

1.6.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/a6fbdc8b7c0b8853f62903bfb365c6f45403c7a4db7614b38c511051259c5588?d=identicon)[ybr-nx](/maintainers/ybr-nx)

![](https://www.gravatar.com/avatar/44c9b950b8b6c31fea0328c20da416cbca715cce7df4a1ac89d1c7020583624b?d=identicon)[kurbar](/maintainers/kurbar)

---

Top Contributors

[![kurbar](https://avatars.githubusercontent.com/u/2259381?v=4)](https://github.com/kurbar "kurbar (154 commits)")[![jissepo](https://avatars.githubusercontent.com/u/14044620?v=4)](https://github.com/jissepo "jissepo (22 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")[![MaVuksTwn](https://avatars.githubusercontent.com/u/178817289?v=4)](https://github.com/MaVuksTwn "MaVuksTwn (2 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/zone-webmail-wildduck-php-client/health.svg)

```
[![Health](https://phpackages.com/badges/zone-webmail-wildduck-php-client/health.svg)](https://phpackages.com/packages/zone-webmail-wildduck-php-client)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[statamic/cms

The Statamic CMS Core Package

4.8k3.2M720](/packages/statamic-cms)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[tamara-solution/php-sdk

Tamara PHP Client Library

10259.4k1](/packages/tamara-solution-php-sdk)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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