calendar links
1.11.0
使用此包,您可以生成链接以将事件添加到日历系统。这是一个简单的例子:
use Spatie CalendarLinks Link ;
Link:: create (
' Birthday ' ,
DateTime:: createFromFormat ( ' Y-m-d H:i ' , ' 2018-02-01 09:00 ' ),
DateTime:: createFromFormat ( ' Y-m-d H:i ' , ' 2018-02-01 18:00 ' )
)-> google ();
这将输出: https://calendar.google.com/calendar/render?action=TEMPLATE&text=Birthday&dates=20180201T090000/20180201T180000&sprop=&sprop=name:
如果您点击该链接(并通过 Google 进行身份验证),您将看到一个屏幕,用于将活动添加到您的日历中。
该软件包还可以生成 ics 文件,您可以在多个电子邮件和日历程序中打开这些文件,包括 Microsoft Outlook、Google 日历和 Apple 日历。
我们投入了大量资源来创建一流的开源包。您可以通过购买我们的一款付费产品来支持我们。
我们非常感谢您从家乡寄给我们一张明信片,并注明您正在使用我们的哪种套餐。您可以在我们的联系页面上找到我们的地址。我们在虚拟明信片墙上发布所有收到的明信片。
您可以通过 Composer 安装该软件包:
composer require spatie/calendar-links
<?php
use Spatie CalendarLinks Link ;
$ from = DateTime:: createFromFormat ( ' Y-m-d H:i ' , ' 2018-02-01 09:00 ' );
$ to = DateTime:: createFromFormat ( ' Y-m-d H:i ' , ' 2018-02-01 18:00 ' );
$ link = Link:: create ( ' Sebastian’s birthday ' , $ from , $ to )
-> description ( ' Cookies & cocktails! ' )
-> address ( ' Kruikstraat 22, 2018 Antwerpen ' );
// Generate a link to create an event on Google calendar
echo $ link -> google ();
// Generate a link to create an event on Yahoo calendar
echo $ link -> yahoo ();
// Generate a link to create an event on outlook . live . com calendar
echo $ link -> webOutlook ();
// Generate a link to create an event on outlook . office . com calendar
echo $ link -> webOffice ();
// Generate a data URI for an ics file ( for iCal & Outlook )
echo $ link -> ics ();
echo $ link -> ics ([ ' UID ' => ' custom-id ' ]); // Custom UID ( to update existing events )
echo $ link -> ics ([ ' URL ' => ' https://my-page.com ' ]); // Custom URL
echo $ link -> ics ([ ' REMINDER ' => []]); // Add the default reminder ( for iCal & Outlook )
echo $ link -> ics ([ ' REMINDER ' => [ ' DESCRIPTION ' => ' Remind me ' , ' TIME ' => new DateTime ( ' tomorrow 12:30 UTC ' )]]); // Add a custom reminder
echo $ link -> ics ([], [ ' format ' => ' file ' ]); // use file output ; e . g . to attach ics as a file to an email .
// Generate a data URI using arbitrary generator :
echo $ link -> formatWith ( new Your Generator ());
Link
类功能应该由至少 2 个生成器支持(不同的服务有不同的功能) 请参阅变更日志以获取更多信息。
composer test
详细信息请参阅贡献。
如果您发现有关安全的错误,请发送邮件至 [email protected],而不是使用问题跟踪器。
您可以自由使用这个软件包(它是 MIT 许可的),但如果它进入您的生产环境,我们非常感谢您从您的家乡给我们寄一张明信片,注明您正在使用我们的哪个软件包。
我们的地址是:Spatie, Samberstraat 69D, 2060 Antwerp,Belgium。
我们在公司网站上发布所有收到的明信片。
麻省理工学院许可证 (MIT)。请参阅许可证文件以获取更多信息。