bvanhoekelen / icalendar-php
轻松创建完整的iCalendar订阅服务。与最好的日历应用、Laravel和Composer兼容。
0.2.1
2019-04-25 14:16 UTC
Requires
- php: >=7.1.0
Requires (Dev)
- larapack/dd: 1.*
- phpunit/phpunit: ^5.7
This package is auto-updated.
Last update: 2024-08-26 02:36:12 UTC
README
composer require bvanhoekelen/icalendar-php
亮点
- 生成简单的ical订阅
示例
<?php require_once('../vendor/autoload.php'); use Calendar\Element\Calendar; use Calendar\Type\Location; use Calendar\Type\Geo; $calender = (new Calendar()) ->setColor('#00A677') ->setName('Custom name') ->setDescription('Custom description') ->setRefreshInterval('P1H') ; // Add Event $calender->newEvent() ->setDtStart(new DateTime('now')) ->setDtEnd(new DateTime('+1 day')) ->setDtStamp(new DateTime('now')) ->setSummary('short summary of the event') ->setDescription('full description of the event') ->setUrl('https://www.google.nl') // Add Location ->setLocationWizard(((new Location()) ->setTitle('Koninklijk Paleis Amsterdam') ->setStreetAddress('Nieuwezijds Voorburgwal 147') ->setZipCode('1012 RJ') ->setCity('Amsterdam') ->setCountry('Nederland') ->setGeo(new Geo(52.373149,4.891342)) )) // Add organizer ->setOrganizerWizard('Bart', 'exemple@gmail.com') // Add attended ->setAttendee((new Attendee()) ->wizard(Attendee::PARTSTAT_ACCEPTED, 'Bart', 'exemple@gmail.com') ) ->setAttendee((new Attendee()) ->wizard(Attendee::PARTSTAT_ACCEPTED, 'Henk', 'exemple2@gmail.com') ) // Add repeat ->setRepeatRule((new RepeatRule(RepeatRule::FREQ_YEARLY)) ->setByDay(RepeatRule::BYDAY_TH) ->setBySetPos(RepeatRule::BYSETPOS_FIRST) ->setByMonth(RepeatRule::BYMONTH_NOV) ->setCount(7) ) ; // Render to string with headers echo $calender->serve();