fbizi/google-meet 问题修复 & 功能扩展

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

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

fbizi/google-meet

最新稳定版本:1.1.1

Composer 安装命令:

composer require fbizi/google-meet

包简介

Google calendar events with meet conference

README 文档

README

Lightweight Google Calendar API library for managing events on Google Calendar. You can create event with video conference (google meet), update and cancel. The library focus only on Calendar Events resource.

Installation

Package is available on Packagist, you can install it using Composer.

composer require fbizi/google-meet

Dependencies

  • PHP 7.4+

Basic usage

Before use this library make sure to register a Google Application and enable Calendar API on Google Cloude Console, so you can make APIs calls. Follow this guide if you don't have yet.

use FBIZI\Calendar\GoogleCalendar;

$calendar = new GoogleCalendar(CLIENT_ID, CLIENT_REDIRECT_URL, CLIENT_SECRET);

// Generate authenticate url link so you can call it
$url = GoogleCalendar::auth(string $client_redirect_url, string $client_id, string $access_type optional, bool $redirect optional);

// check if get the response code after calling the authentication url
if(isset($_GET['code']) && !empty($_GET['code'])){
    $code = $_GET['code'];
    $calendar->getAccessToken($code);

    // if you want to save the token and refresh_token somewhere for use later e.g DB just call this
    $token_to_save = $calendar->token;
    $refresh_token_to_save = $calendar->refresh_token;

    // if want to assign saved token and refresh_token just do this
    $calendar->token = $token_to_save; 
    $calendar->refresh_token = $refresh_token_to_save;

    // for event creation
    $timezone = $calendar->getCalendarTimezone(); // to get user calendar timezone

    $args = [
        "title" => "Event title", // optional
        "description" => "Event description", // optional
        "start" => [
                "dateTime" => "2024-12-31T12:00:00",
                "timeZone" => $timezone['value']
        ],
        "end" => [
            "dateTime" => "2024-12-31T13:00:00",
            "timeZone" => $timezone['value'],
        ],
        "attendees" => [
            ["email" => "test1@test.com"]
        ],
        "meet_id" => "jdjhjdhdjdj", // optional
    ];

    $event = GoogleCalendar::eventData(array $args);

    $data = $calendar->createEvent(array $event, string $calendar_id optional);
    // on successful will get the event resource
    // retrive event id or meet link $data['id'] | $data['hangoutLink']
    
    // for event update
    $timezone = $calendar->getCalendarTimezone(); // to get user calendar timezone

    $args['attendees'] = [
        ["email" => "test1@test.com"],
        ["email" => "test2@test.com"] // add 1 more attendee
    ];

    $event_id = $data['id'];

    $event = GoogleCalendar::eventData(array $args);

    $data = $calendar->updateEvent(string $event_id, array $event, string $calendar_id optional);
    // on successful will get the event resource
    
    // for event cancellation
    $calendar->cancelEvent($data['id']);
    
    // explore other methods such as get event or calendar by id 
}

Donation

Methods :

If this project help you reduce time to develop, you can give me a cup of coffee :)

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-10-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固