Fork me on GitHub

0.1

Last updated: Aug 20, 2016

PHP Exchange Web Services

The PHP Exchange Web Services library (php-ews) is intended to make communication with Microsoft Exchange servers using Exchange Web Services easier. It handles the NTLM authentication required to use the SOAP services and provides an object-oriented interface to the complex types required to form a request.

Dependencies

*Note: Not all operations or request elements are supported on Exchange 2007.

Installation

Download the latest release from github and extract the archive into your project.

Autoloading

Theis version is not PSR-0 compliant so you will need to include files in one of two ways:

1. Include each file as you need it. Each data type is contained within its own file and will need to be included individualy. For example:

require_once 'php-ews/EWSType/CalendarItemType.php';
require_once 'php-ews/EWSType/BodyType.php';

2. Use a custom autoload function. For example:

/**
 * Function to autoload the requested class name.
 * 
 * @param string $class_name Name of the class to be loaded.
 * @return boolean Whether the class was loaded or not.
 */
function __autoload($class_name)
{
    // Start from the base path and determine the location from the class name.
    $base_path = 'path/to/php-ews/';
    $include_file = $base_path . str_replace('_', '/', $class_name) . '.php';

    return (file_exists($include_file) ? require_once $include_file : false);
}

Usage

The library can be used to make several different request types. In order to make a request, you need to instantiate a new ExchangeWebServices object:

$ews = new ExchangeWebServices($server, $username, $password, $version);

The ExchangeWebServices class takes four parameters for its constructor:

Once you have your ExchangeWebServices object, you need to build your request object. The type of object depends on the operation you are calling. If you are using an IDE with code completion it should be able to help you determine the correct classes to use using the provided docblocks.

The request objects are build similar to the XML body of the request. See the resources section below for more information on building the requests.

Resources

Support

All questions should use the issue queue. This allows the community to contribute to and benefit from questions or issues you may have. Any support requests received via email will be directed here.