Download the PHP package sebastiankrupinski/jmap-client-php without Composer
On this page you can find all versions of the php package sebastiankrupinski/jmap-client-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sebastiankrupinski/jmap-client-php
More information about sebastiankrupinski/jmap-client-php
Files in sebastiankrupinski/jmap-client-php
Package jmap-client-php
Short Description Type-safe PHP client for JMAP mail, calendar, contacts, files, and tasks APIs
License AGPL-3.0-only
Homepage https://github.com/SebastianKrupinski/jmap-client-php
Informations about the package jmap-client-php
JMAP PHP Client
A fully-typed JMAP (JSON Meta Application Protocol) client library for PHP.
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
- 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
- PHP >= 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 viaphp-http/discovery.
Installation
Install the library, plus any PSR-18 client (Guzzle is used here as an example):
Or, if you're manually managing dependencies in your composer.json:
Then run:
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:
Note: TLS verification and proxy settings must be configured on the injected client;
configureTransportVerification()is deprecated and no longer applies per request.
Quick Start
Usage Examples
Setting Up a Client with Different Authentication Methods
Basic Authentication
Bearer Token Authentication
Working with Mail
Listing Mailboxes
Fetching Recent Messages from a Mailbox
Working with Contacts
Fetching Address Books
Fetching Specific Contacts
Listing All Contacts in an Address Book
Server Capability Detection
Session Information
Configuration
Transport Settings
Debug Logging
SSL/TLS Certificate Verification
Error Handling
The JMAP client returns ResponseException objects when JMAP-level errors occur. Here's how to handle them:
Common JMAP Error Types
- unknownMethod - The JMAP method is not supported by the server
- invalidArguments - The request contains invalid parameters
- requestTooLarge - The request payload exceeds server size limits
- unsupportedFilter - The filter criteria is not supported
- stateMismatch - The state parameter doesn't match the current server state
- forbidden - The authenticated user does not have permission
- accountNotFound - The specified account was not found
- serverUnavailable - The server is temporarily unavailable
Contributing
Contributions are welcome! Please ensure that:
- Code is properly type-hinted
- Changes include appropriate documentation
For local validation, the most useful project scripts are:
License
This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0-only). See the LICENSE file for details.
Author
Sebastian Krupinski
- Email: [email protected]
- GitHub: SebastianKrupinski
Support
For issues, questions, or contributions, please visit the project repository.
Note: This library implements the JMAP specification as defined at https://jmap.io/
All versions of jmap-client-php with dependencies
ext-json Version *
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.1 || ^2.0
php-http/discovery Version ^1.19