项目作者: bvanhoekelen

项目描述 :
📆 Create easily a full iCalendar subscription service. Compatible with the best Calendar Apps, Laravel and Composer.
高级语言: PHP
项目地址: git://github.com/bvanhoekelen/icalendar-php.git
创建时间: 2019-01-24T14:41:03Z
项目社区:https://github.com/bvanhoekelen/icalendar-php

开源协议:Apache License 2.0

下载


📆 PHP iCalendar simple parser tool 🛠

Hex.pm
GitHub release
Packagist
Github issues

  1. composer require bvanhoekelen/icalendar-php

Highlight

  • Generate simpel ical sub

Example

  1. <?php
  2. require_once('../vendor/autoload.php');
  3. use Calendar\Element\Calendar;
  4. use Calendar\Type\Location;
  5. use Calendar\Type\Geo;
  6. $calender = (new Calendar())
  7. ->setColor('#00A677')
  8. ->setName('Custom name')
  9. ->setDescription('Custom description')
  10. ->setRefreshInterval('P1H')
  11. ;
  12. // Add Event
  13. $calender->newEvent()
  14. ->setDtStart(new DateTime('now'))
  15. ->setDtEnd(new DateTime('+1 day'))
  16. ->setDtStamp(new DateTime('now'))
  17. ->setSummary('short summary of the event')
  18. ->setDescription('full description of the event')
  19. ->setUrl('https://www.google.nl')
  20. // Add Location
  21. ->setLocationWizard(((new Location())
  22. ->setTitle('Koninklijk Paleis Amsterdam')
  23. ->setStreetAddress('Nieuwezijds Voorburgwal 147')
  24. ->setZipCode('1012 RJ')
  25. ->setCity('Amsterdam')
  26. ->setCountry('Nederland')
  27. ->setGeo(new Geo(52.373149,4.891342))
  28. ))
  29. // Add organizer
  30. ->setOrganizerWizard('Bart', 'exemple@gmail.com')
  31. // Add attended
  32. ->setAttendee((new Attendee())
  33. ->wizard(Attendee::PARTSTAT_ACCEPTED, 'Bart', 'exemple@gmail.com')
  34. )
  35. ->setAttendee((new Attendee())
  36. ->wizard(Attendee::PARTSTAT_ACCEPTED, 'Henk', 'exemple2@gmail.com')
  37. )
  38. // Add repeat
  39. ->setRepeatRule((new RepeatRule(RepeatRule::FREQ_YEARLY))
  40. ->setByDay(RepeatRule::BYDAY_TH)
  41. ->setBySetPos(RepeatRule::BYSETPOS_FIRST)
  42. ->setByMonth(RepeatRule::BYMONTH_NOV)
  43. ->setCount(7)
  44. )
  45. ;
  46. // Render to string with headers
  47. echo $calender->serve();

See more examples.

Help, docs and links