dyvelop/icalcreator-bundle
Composer 安装命令:
composer require dyvelop/icalcreator-bundle
包简介
Symfony bundle for creating iCal formatted files
README 文档
README
Dyvelop iCalcreator Bundle
This bundle provides some utilities for using the iCalcreator PHP library (http://kigkonsult.se/iCalcreator/index.php) in Symfony.
Installation
Step 1: Download
Download via Composer
composer require dyvelop/icalcreator-bundle
This project requires the packagist distribution from https://github.com/iCalcreator/iCalcreator in version 2.22.
Step 2: Enable Bundle
Enable the Bundle in the app/AppKernel.php file in your Symfony project:
// File: app/AppKernel.php class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new \Dyvelop\ICalCreatorBundle\DyvelopICalCreatorBundle(), ); // ... return $bundles; } // ... }
Configuration
Unique ID
You can change the default unique ID for calendars with following configuration.
dyvelop_icalcreator: default_unique_id: DyvelopICalCreatorBundle
Timezone
If you want to create calendar events in a timezone with daylight saving time (or summer time), you can set a default timezone globally via config:
dyvelop_icalcreator: default_timezone: Europe/Berlin
Usage
Basic usage
Create a new calendar:
$config = array( 'unique_id' => 'My unique calendar name', 'format' => 'ical', // or 'xcal' 'filename' => 'my-calendar.ics' // or 'my-calendar.xml' ); $calendar = $this->get('dyvelop_icalcreator.factory')->create($config);
Create a new calendar event:
$event = $calendar->newEvent(); $event->setUid('foo'); $event->setSummary('Bar'); $event->setDtstart(2016, 10, 6, 20); $event->setDtend(2016, 10, 6, 21);
See http://kigkonsult.se/iCalcreator/docs/using.html for detailed documentation of the iCalcreate PHP library.
Render calendar via controller
After creating a calendar you can use the CalendarResponse to render the file in your Symfony controller.
namespace AppBundle/Controller; use Dyvelop\ICalCreatorBundle\Response\CalendarResponse; use Symfony\Bundle\FrameworkBundle\Controller\Controller; class DefaultController extends Controller { public function indexAction() { $calendar = $this->get('dyvelop_icalcreator.factory')->create(); // add events to calendar etc. // ... return new CalendarResponse($calendar); } }
Attach calender file in mails
Using the CalendarAttachment class you can attach your calendar file in a Swiftmailer mail message.
use Dyvelop\ICalCreatorBundle\Mailer\CalendarAttachment; // create a new mail message via Swiftmailer $mailer = $this->get('mailer'); $message = $mailer->createMessage(); // create calendar $calendar = $this->get('dyvelop_icalcreator.factory')->create(); // add events to calendar etc. // ... // add calender attachment $attachment = new CalendarAttachment($calendar); $message->attach($attachment); // add other message configurations like subject or body // ... $mailer->send($message);
dyvelop/icalcreator-bundle 适用场景与选型建议
dyvelop/icalcreator-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6.55k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2016 年 06 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 dyvelop/icalcreator-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 dyvelop/icalcreator-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 6.55k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-06-12