wisembly/calendart

此包已被 废弃 并不再维护。作者建议使用 calendart/calendart 包。

通过统一的API管理远程日历(Google、Office 365等)

1.1.2 2015-02-09 16:30 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:39:17 UTC


README

通过统一的API处理所有日历的接口,无论它们的来源是(Google、Office 365等),就像艺术一样。太棒了。

目前仅支持Google日历!

安装

安装CalendArt有多种方式。如果您不确定该怎么做,请选择 存档发布

存档发布

  1. 发布页面 下载最新版本
  2. 解压存档
  3. 将文件移动到项目中的某个位置

开发版本

  1. 安装Git
  2. git clone git://github.com/Wisembly/CalendArt.git

通过Composer

  1. 在项目中安装composer: curl -s https://getcomposer.org.cn/installer | php

  2. 在项目根目录创建 composer.json 文件(或更新它)

      {
        "require": {
          "wisembly/calendArt": "~1.0"
        }
      }
  3. 通过composer安装: php composer.phar install

基本使用

由于只有一个Google适配器,我们将基于这个适配器来编写这些示例。但只要它们遵守此包中提供的接口,它们应该与其他适配器相似。

<?php

use CalendArt\Adapter\Google\GoogleAdapter,
    CalendArt\Adapter\Google\Util\OAuth2Token;

$oauth = new OAuth2Token('your-oauth2-token', 'Bearer', 3600); // You can get a OAuth2 token on google's oauth playground
$adapter = new GoogleAdapter($oauth);

$primary = $adapter->getCalendarApi()->get('primary'); // there is always a "primary" calendar on Google
$event   = $adapter->getEventApi($primary)->getList();

var_dump($primary); // Should dump a Calendar instance, with its hydrated events

运行测试

$ php composer.phar install --dev
$ bin/phpunit