iCal Library for PHP

iCal Library for PHP

https://ift.tt/38w9B9z

iCal Library for PHP

Markus Poerschke has PHP package that provides an abstraction layer for creating iCalendars:

use Eluceo\iCal\Component\Calendar; use Eluceo\iCal\Component\Event; $vCalendar = new Calendar('www.example.com'); $vCalendar->setName('Example Calendar'); $vCalendar->setTimezone('America/New_York'); $vEvent = new Event(); $vEvent ->setDtStart(new \DateTime('2012-12-24')) ->setDtEnd(new \DateTime('2012-12-24')) ->setNoTime(true) ->setSummary('Christmas'); $vCalendar->addComponent($vEvent); header('Content-Type: text/calendar; charset=utf-8'); header('Content-Disposition: attachment; filename="cal.ics"'); echo $vCalendar->render(); 

The library supports the following iCalendar components:

  • VCALENDAR
  • VEVENT
  • VALARM
  • VTIMEZONE

After incorporating it in your application, here’s an example of linking to a calendar:

<a href="webcal://www.example.com/holidays.ics">Subscribe (iCal)</a> 

You can learn more about this package, get full installation instructions, and view the source code on GitHub at markuspoerschke/iCal.

Filed in: News

programming

via Laravel News https://ift.tt/14pzU0d

January 21, 2020 at 09:23AM