fungio/google-calendar-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

fungio/google-calendar-bundle

Composer 安装命令:

composer require fungio/google-calendar-bundle

包简介

Provides a google calendar integration for your Symfony 3 Project.

关键字:

README 文档

README

This bundle use Google API for list, create, or update events in Google Calendar.

Please feel free to contribute, to fork, to send merge request and to create ticket.

Requirement

Create a API account

Go to the developers console : https://console.developers.google.com

Create an oauth ID. Do not forget the redirect Uri.

Click on "Download JSON" to get your client_secret.json

Installation

Step 1: Install GoogleCalendarBundle

Run

composer require fungio/google-calendar-bundle:dev-master

Step 2: Enable the bundle

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = [
        // ...
        new Fungio\GoogleCalendarBundle\FungioGoogleCalendarBundle()
    ];
}

Step 3: Configuration

Copy your client_secret.json file for example in app/Resources/GoogleCalendarBundle/client_secret.json

# app/config/parameters.yml

fungio_google_calendar:
    google_calendar:
        application_name: "Google Calendar"
        credentials_path: "%kernel.root_dir%/.credentials/calendar.json"
        client_secret_path: "%kernel.root_dir%/Resources/GoogleCalendarBundle/client_secret.json"

Example

<?php
// in a controller
$request = $this->get('request_stack')->getMasterRequest();

$googleCalendar = $this->get('fungio.google_calendar');
$googleCalendar->setRedirectUri($redirectUri);

if ($request->query->has('code') && $request->get('code')) {
    $client = $googleCalendar->getClient($request->get('code'));
} else {
    $client = $googleCalendar->getClient();
}

if (is_string($client)) {
    return new RedirectResponse($client);
}

$events = $googleCalendar->getEventsForDate('primary', new \DateTime('now');

统计信息

  • 总下载量: 42.18k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 10
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 10
  • Watchers: 2
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-10-07