PHP code example of znanylekarz / ical

1. Go to this page and download the library: Download znanylekarz/ical library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

znanylekarz / ical example snippets


$vCalendar = new \Eluceo\iCal\Component\Calendar('www.example.com');

$vEvent = new \Eluceo\iCal\Component\Event();

$vEvent->setDtStart(new \DateTime('2012-12-24'));
$vEvent->setDtEnd(new \DateTime('2012-12-24'));
$vEvent->setNoTime(true);
$vEvent->setSummary('Christmas');

$vCalendar->addEvent($vEvent);

header('Content-Type: text/calendar; charset=utf-8');
header('Content-Disposition: attachment; filename="cal.ics"');

echo $vCalendar->render();