PHPackages                             sagar/outlook-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. [API Development](/categories/api)
4. /
5. sagar/outlook-php

ActivePackage[API Development](/categories/api)

sagar/outlook-php
=================

The api to handle outlook rest api using php

0.1.6(7y ago)1412.7k4[4 issues](https://github.com/sagarrabadiya/outlook-php/issues)MITPHP

Since Sep 10Pushed 7y ago2 watchersCompare

[ Source](https://github.com/sagarrabadiya/outlook-php)[ Packagist](https://packagist.org/packages/sagar/outlook-php)[ RSS](/packages/sagar-outlook-php/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (2)Versions (9)Used By (0)

outlook-rest-php
================

[](#outlook-rest-php)

A handy tool to work with outlook rest api

example code is available in the examples directory
---------------------------------------------------

[](#example-code-is-available-in-the-examples-directory)

#### Installation

[](#installation)

```
    composer require sagar/outlook-php
```

#### Authenticator

[](#authenticator)

```
define('APP_ID', '07cdaba2-7865-4cec-8c82-b6d69679c88c');
define('APP_PASSWORD', 'qR7tHeUpDhLXiZhPdXaT5aU');

// redirect uri can be one of the absolute url registered with the app
// if not given or null then it takes current url
$authenticator = new Outlook\Authorizer\Authenticator(APP_ID, APP_PASSWORD, $redirectUri = null);

// to get token from code the below function call should be placed at the top of page
// where redirection is coming back
// the below function simply exchange code and get token from authorization server.
$token = $authenticator->getToken();

if(!$token) {
    //if $token is not available then we get login url
    echo $authenticator->getLoginUrl($scopes = [], $redirectUri = null);
} else {
    // if $token is available it is instance of Outlook\Authorizer\Token
    var_dump($token);
}
```

#### Event Management

[](#event-management)

```
define('APP_ID', '07cdaba2-7865-4cec-8c82-b6d69679c88c');
define('APP_PASSWORD', 'qR7tHeUpDhLXiZhPdXaT5aU');

$authenticator = new Outlook\Authorizer\Authenticator(
    APP_ID,
    APP_PASSWORD,
    $redirectUri = "http://localhost/outlook-php/examples/events.php"
);

// create session instance which implements SessionContract
// you can replace session implementation with your class implementing SessionContract
$sessionManager = new \Outlook\Authorizer\Session();

//token can be removed manually
//$sessionManager->remove(); // if need to remove token manually from session

// create event authorizer to get token with appropriate scope
// it accepts authenticator and session instance
$eventAuthorizer = new \Outlook\Events\EventAuthorizer($authenticator, $sessionManager);

// if token is already available in session and not expired
$token = $eventAuthorizer->isAuthenticated();

if (!$token) {
    //if token is not available we create login url with necessary scopes
    echo 'Login';
} else {
    //if we have token we can create eventManager
    // it accepts Outlook\Authorizer\Token as argument
    $eventManager = new \Outlook\Events\EventManager($token);

    // get all events returns each item as Event object
    $events = $eventManager->all();

    foreach ($events as $event) {
        echo $event->id. " -> ". $event;
        echo '';
    }

    //get single event returns Outlook\Events\Event instance
    $event = $eventManager->get($eventId = 'XXXX');
    var_dump($event);

    //create event accepts Outlook\Events\Event instance
    // nested key name must be case sensitive correctly according to their docs.
    // only outer properties will be converted to Study case automatically
    $event = new \Outlook\Events\Event(['subject' => 'Discuss the Calendar REST API']);
    $event->body = ['ContentType' => 'HTML', 'Content' => 'Hello this is test Event'];
    $event->start = ["DateTime" => "2014-02-02T18:00:00", "TimeZone" => "Pacific Standard Time"];
    $event->end = ["DateTime" => "2014-02-02T19:00:00", "TimeZone" => "Pacific Standard Time"];
    $event = $eventManager->create($event);
    var_dump($event);

    //update event accepts Outlook\Events\Event instance with valid id
    $event = $eventManager->get($eventId = 'XXXX');
    $event->Body->Content = "new Updated Content";
    $updateEvent = $eventManager->update($event);
    var_dump($updateEvent); // event instance with updated values

    //delete event accepts Outlook\Events\Event instance with valid id
    $event = $eventManager->get($eventId = 'XXXX');
    $response = $eventManager->delete($event);
    var_dump($response); // response true or raised exception
```

Api Documentation
=================

[](#api-documentation)

- [Outlook Rest Api](https://msdn.microsoft.com/en-us/office/office365/api/calendar-rest-operations)

TODO
====

[](#todo)

- Add support for sync events
- Add contacts apis
- Add mail apis

contributions
=============

[](#contributions)

- pull requests are most welcome.
- please follow psr2 standards for the code and submit your pull request with valid breaking/enhancement use case.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance14

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.5% 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 ~147 days

Recently: every ~32 days

Total

7

Last Release

2690d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c36c6a5cb6c558a8f67f7349194607f3bc98bea3d1fd55b7789c61a8395fa652?d=identicon)[sagarrabadiya](/maintainers/sagarrabadiya)

---

Top Contributors

[![sagarrabadiya](https://avatars.githubusercontent.com/u/5405403?v=4)](https://github.com/sagarrabadiya "sagarrabadiya (21 commits)")[![JanPetterMG](https://avatars.githubusercontent.com/u/11933090?v=4)](https://github.com/JanPetterMG "JanPetterMG (1 commits)")

---

Tags

outlookphp-rest-outlook

### Embed Badge

![Health badge](/badges/sagar-outlook-php/health.svg)

```
[![Health](https://phpackages.com/badges/sagar-outlook-php/health.svg)](https://phpackages.com/packages/sagar-outlook-php)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k532.1M19.4k](/packages/laravel-framework)[statamic/cms

The Statamic CMS Core Package

4.8k3.5M916](/packages/statamic-cms)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3661.2M46](/packages/tencentcloud-tencentcloud-sdk-php)[smodav/mpesa

M-Pesa API implementation

16167.1k1](/packages/smodav-mpesa)[imdhemy/google-play-billing

Google Play Billing

491.4M5](/packages/imdhemy-google-play-billing)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

232.5k](/packages/eslazarev-wildberries-sdk)

PHPackages © 2026

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