如何使用PHP Laravel通过邮件创建Google日历邀请

时间:2019-05-21 09:56:37

标签: php laravel calendar invite

我想逐步说明如何使用php通过邮件发送日历邀请。

我已参考下面给出的此链接的第二个答案。 send invitation using google calendar API in php 但无法理解代码。请简要说明。

1 个答案:

答案 0 :(得分:1)

使用软件包spatie/laravel-google-calendar,这是一个流行的软件包,用于管理Google日历上的事件。

示例:

use Spatie\GoogleCalendar\Event;

//create a new event
$event = new Event;

$event->name = 'A new event';
$event->startDateTime = Carbon\Carbon::now();
$event->endDateTime = Carbon\Carbon::now()->addHour();
$event->addAttendee(['email' => 'youremail@gmail.com']);
$event->addAttendee(['email' => 'anotherEmail@gmail.com']);

$event->save();

有关详细的安装说明,请参阅自述文件。

链接: https://github.com/spatie/laravel-google-calendar