PHPackages                             sebastiankrupinski/jmap-client-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. [Mail &amp; Notifications](/categories/mail)
4. /
5. sebastiankrupinski/jmap-client-php

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

sebastiankrupinski/jmap-client-php
==================================

Type-safe PHP client for JMAP mail, calendar, contacts, files, and tasks APIs

v2.0.0(3w ago)4738AGPL-3.0-onlyPHPPHP ^8.0CI failing

Since May 5Pushed 3w ago1 watchersCompare

[ Source](https://github.com/SebastianKrupinski/jmap-client-php)[ Packagist](https://packagist.org/packages/sebastiankrupinski/jmap-client-php)[ Docs](https://github.com/SebastianKrupinski/jmap-client-php)[ RSS](/packages/sebastiankrupinski-jmap-client-php/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (3)Dependencies (10)Versions (6)Used By (0)

JMAP PHP Client
===============

[](#jmap-php-client)

A fully-typed JMAP (JSON Meta Application Protocol) client library for PHP.

About
-----

[](#about)

This project provides a type-safe, object-oriented PHP client library for interacting with JMAP servers. JMAP is a modern, JSON-based protocol for accessing email, calendar, and contact data, designed to be more efficient and flexible than traditional protocols like IMAP and CalDAV.

The library is built with PHP 8.0+ strict typing in mind, ensuring robust type safety and excellent IDE support throughout your codebase.

Features
--------

[](#features)

- **Broad JMAP Coverage** - Request and response types for core, mail, contacts, calendar, files, and tasks workflows
- **Type-Safe** - Built with PHP 8.0+ strict types for better code quality and IDE support
- **Multiple Authentication Methods** - Support for Basic auth, bearer tokens, JSON login flows, cookie-backed sessions, and custom authentication schemes
- **Session Management** - Automatic session discovery, account lookup, and capability negotiation
- **Request Bundling** - Compose related JMAP method calls into a single round trip
- **Transport Diagnostics** - Built-in request/response retention and NDJSON-style transport logging for debugging
- **Error Handling** - Comprehensive transport and JMAP-level error handling

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

[](#requirements)

- **PHP** &gt;= 8.0
- **ext-json** - JSON extension for PHP
- A **PSR-18** HTTP client and **PSR-17** HTTP factories. The library depends only on the PSR interfaces (`psr/http-client`, `psr/http-factory`, `psr/http-message`) and is not tied to any specific implementation. When no client/factories are injected, an installed implementation is auto-discovered via [`php-http/discovery`](https://github.com/php-http/discovery).

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

[](#installation)

Install the library, plus any PSR-18 client (Guzzle is used here as an example):

```
composer require sebastiankrupinski/jmap-client-php guzzlehttp/guzzle
```

Or, if you're manually managing dependencies in your `composer.json`:

```
{
    "require": {
        "sebastiankrupinski/jmap-client-php": "^2.0",
        "guzzlehttp/guzzle": "^7.0"
    }
}
```

Then run:

```
composer install
```

### Injecting a specific HTTP client

[](#injecting-a-specific-http-client)

To use a particular PSR-18 client and PSR-17 factories (for example Nextcloud's HTTP client so that SSRF protection, DNS pinning and proxy configuration apply), pass them to the constructor or via setters:

```
$client = new Client('jmap.example.com:443', $authentication, $psr18Client, $requestFactory, $streamFactory);
// or
$client->setHttpClient($psr18Client);
$client->setRequestFactory($requestFactory);
$client->setStreamFactory($streamFactory);
```

> **Note:** TLS verification and proxy settings must be configured on the injected client; `configureTransportVerification()` is deprecated and no longer applies per request.

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

[](#quick-start)

```
