Download the PHP package horde/mapi without Composer

On this page you can find all versions of the php package horde/mapi. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mapi

Horde MAPI

MAPI utility library – helper library for Microsoft MAPI data structures in the Horde Framework.

Package horde/mapi
Upstream github.com/horde/mapi
License LGPL-2.1
Author Michael J Rubinsky
PHP ^8.1
Dependencies horde/date, horde/exception, PHP extension bcmath

What is MAPI?

MAPI (Messaging Application Programming Interface) is Microsoft's API for messaging, calendars, and contacts—primarily in Exchange and Outlook. In Horde, this library is not a full MAPI client or Exchange connector. It provides binary format helpers used by Microsoft protocols, especially Exchange ActiveSync.

Typical use cases in Horde:

Architecture

The library is intentionally small and consists of three classes:

Horde_Mapi

General MAPI helper functions (all static):

Method Description
isLittleEndian() Checks the system's byte order
chbo($num) Reverses the byte order of an integer (for big-endian systems)
getUidFromGoid($goid) Extracts a UID from a Base64-encoded GOID
createGoid($uid) Creates a Base64-encoded GOID from a UID
filetimeToUnixtime($ft) Converts binary Windows FILETIME to a Unix timestamp

MAPI structures are encoded in little-endian order. On big-endian systems, values are adjusted with chbo() before packing/unpacking.

filetimeToUnixtime() requires the PHP bcmath extension because FILETIME uses 64-bit values that PHP cannot represent natively. Without bcmath, it returns -1.

Horde_Mapi_Timezone

Converts between Microsoft's timezone blob and PHP/IANA timezones.

Microsoft defines timezones as a binary TIME_ZONE_INFORMATION structure (bias, standard/daylight names, SYSTEMTIME transitions, etc.). ActiveSync transmits this structure Base64-encoded in the WBXML protocol.

Method Direction Description
getOffsetsFromSyncTZ($data) MAPI blob → array Decodes an ActiveSync timezone blob into an offset hash
getSyncTZFromOffsets($offsets) array → MAPI blob Builds an ActiveSync-compatible timezone blob
getOffsetsFromDate(Horde_Date $date) IANA TZ → array Derives offsets from a Horde_Date/timezone
getTimezone($offsets, $expectedTimezone) MAPI blob/array → IANA Guesses the matching Olson timezone
getListOfTimezones($offsets, $expectedTimezone) MAPI blob/array → array All matching IANA identifiers

Reverse mapping (MAPI offsets → IANA timezone) is ambiguous: multiple timezones can share the same offsets. You can pass $expectedTimezone to prefer a specific match; otherwise Horde_Date::getTimezoneAlias() picks an alias.

Logic for detecting the nth weekday occurrence in a month (e.g. "second Sunday in March") is partly inspired by the Tine 2.0 project.

Horde_Mapi_Exception

Base exception class (extends Horde_Exception_Wrapped), e.g. for missing bcmath extension or no matching timezone.

How it works

1. Timezone blob (ActiveSync)

Reverse direction when receiving:

2. Global Object Identifier (GOID)

GOIDs uniquely identify appointments across Exchange/Outlook. The library supports two formats:

3. FILETIME

Windows stores timestamps as 64-bit counters in 100-ns ticks since 1 Jan 1601 UTC. Conversion steps:

  1. Hex string from binary data
  2. Flip endianness (_flipEndian)
  3. Hex → bcmath integer (_hexToBcint)
  4. Subtract epoch offset and divide by 10,000,000 (_win64ToUnix)

Usage in a Horde installation

horde/mapi is used mainly indirectly via ActiveSync:

Module File Usage
ActiveSync Horde/ActiveSync/Message/Appointment.php setTimezone() / getTimezone() for appointment sync
ActiveSync Horde/ActiveSync/Message/MeetingRequest.php createGoid() for meeting UIDs, timezone parsing
Kronolith lib/Event.php _handleEas16Exception() – resolve timezone from ActiveSync message

These functions previously lived in Horde_ActiveSync_Utils and Horde_ActiveSync_Timezone; since Horde 6 they were moved into horde/mapi (the old classes are marked @deprecated).

Examples

Create a timezone blob

Parse a timezone blob

GOID ↔ UID

Convert FILETIME

Installation

Via Composer (in Horde, typically as a framework dependency):

In this installation: dev-FRAMEWORK_6_0 (Horde Framework 6).

Tests

Tests live under test/Unnamespaced/ (MapiTest.php, TimezoneTest.php) with fixtures for GOIDs and FILETIME.

Further reading


All versions of mapi with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
horde/date Version ^3 || dev-FRAMEWORK_6_0
horde/exception Version ^3 || dev-FRAMEWORK_6_0
ext-bcmath Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package horde/mapi contains the following files

Loading the files please wait ...