crusherrl / ics-link-generator
一个小型的 vanilla php ics 链接生成器
1.0.0
2023-09-05 11:28 UTC
Requires
- php: ^8.0
This package is auto-updated.
Last update: 2024-09-05 13:40:58 UTC
README
此项目为不同平台创建各种 ics/event 网址,例如 Outlook + 移动,Office 365 + 移动,Google,Yahoo 和 AOL。
安装
composer require crusherrl/ics-link-generator
使用方法
use CrusherRL\IcsLinksGenerator; // ... $start = '2023-08-15 15:00:00'; // required $end = '2023-08-15 16:30:00'; // required $summary = 'summaryHey!'; // optional $location = 'locationHey!'; // optional $description = 'descriptionHey!'; // optional $allDay = 'false'; // optional - NOTE: it should be true or false as string, since we urlencode this, it would be converted to 0 (false) or 1 (true) // Building base for the generator $generator = new IcsLinksGenerator($start, $end, $summary, $location, $description, $allDay); // OR $generator = IcsLinksGenerator::make(['DTSTART' => $start, 'DTEND' => $end]); // Actual Generating the urls // Generating all possible urls $urls = $generator->generate(); // Generating only specific urls $urls = $generator->generateSpecific(['yahoo', 'aol', 'outlook_mobile']);
输出
生成网址后,我们会收到这些类型的数组。
序列化
非序列化
格式输出
如果需要,您可以在生成网址之前更改标签。只需简单地设置您想要更改的标签。
use CrusherRL\IcsLinksGenerator; // ... $generator->setLabels(['outlook' => 'Outlook.com']);
我们的输出将从这个
{ "outlook": { "client": "outlook", "label": "Outlook", "url": "https:\/\/outlook.live.com\/calendar\/0\/action\/compose?&allday=false&body=&enddt=2023-08-15T16%3A30%3A00&location=&path=%2Fcalendar%2Faction%2Fcompose&rru=addevent&startdt=2023-08-15T15%3A00%3A00&subject=" } }
变为这个
{ "outlook": { "client": "outlook", "label": "Outlook.com", "url": "https:\/\/outlook.live.com\/calendar\/0\/action\/compose?&allday=false&body=&enddt=2023-08-15T16%3A30%3A00&location=&path=%2Fcalendar%2Faction%2Fcompose&rru=addevent&startdt=2023-08-15T15%3A00%3A00&subject=" } }
生成网址。
如果您需要生成 1 或 2 个非序列化的网址。这是您如何做到的。
use CrusherRL\IcsLinksGenerator; // ... // Actual Generating the urls // Generating all possible urls $urls = $generator->generate(false); // Generating only specific urls $urls = $generator->generateSpecific(['yahoo', 'aol', 'outlook_mobile'], false); // OR you can get url only like this $aol = $generator->makeAOLUrl(); $yahoo = $generator->makeYahooUrl(); $google = $generator->makeGoogleUrl(); $office = $generator->makeOfficeUrl(); $officeMobile = $generator->makeOfficeMobileUrl(); $outlook = $generator->makeOutlookUrl(); $outlookMobile = $generator->makeOutlookMobileUrl();
如何贡献
- 克隆存储库
- 在 laravel nova 应用的
composer.json
中添加以下内容
{
//...
"require" {
"crusherrl/ics-link-generator: "*"
},
//...
"repositories": [
{
"type": "path",
"url": "../path_to_your_package_folder"
}
],
}
- 运行
composer update crusherrl/ics-link-generator
现在您已准备好开始贡献了!