sagar/outlook-php
Composer 安装命令:
composer require sagar/outlook-php
包简介
The api to handle outlook rest api using php
README 文档
README
A handy tool to work with outlook rest api
example code is available in the examples directory
Installation
composer require sagar/outlook-php
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
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 '<a href='.$eventAuthorizer->getLoginUrl().'>Login</a>'; } 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 '<br />'; } //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
TODO
- Add support for sync events
- Add contacts apis
- Add mail apis
contributions
- pull requests are most welcome.
- please follow psr2 standards for the code and submit your pull request with valid breaking/enhancement use case.
sagar/outlook-php 适用场景与选型建议
sagar/outlook-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12.8k 次下载、GitHub Stars 达 14, 最近一次更新时间为 2016 年 09 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「outlook」 「php-rest-outlook」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sagar/outlook-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sagar/outlook-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sagar/outlook-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This package developed for easy integration of ics-file generating.
Read and write Microsoft Outlook MSG files in modern PHP
Scan all dom and add/replace width attribute, make sure table/img in outlook desktop will be working
PHP Class to generate VCalendar (ics) file
The api to handle outlook rest api using php
OUtlook/Office 365 Connect strategy for Opauth
统计信息
- 总下载量: 12.8k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 14
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-09-10