PHP code example of phpfui / icalendar

1. Go to this page and download the library: Download phpfui/icalendar 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/ */

    

phpfui / icalendar example snippets


$icalobj = new \ICalendarOrg\ZCiCal();

$eventobj = new \ICalendarOrg\ZCiCalNode("VEVENT", $icalobj->curnode);

// add start date
$eventobj->addNode(new \ICalendarOrg\ZCiCalDataNode("DTSTART:" . \ICalendarOrg\ZDateHelper::fromSqlDateTime("2020-01-01 12:00:00")));

// add end date
$eventobj->addNode(new \ICalendarOrg\ZCiCalDataNode("DTEND:" . \ICalendarOrg\ZDateHelper::fromSqlDateTime("2020-01-01 13:00:00")));

echo $icalobj->export();

$icalobj = new \ICalendarOrg\ZCiCal();
$eventobj1 = new \ICalendarOrg\ZCiCalNode("VEVENT", $icalobj->curnode);
$eventobj1->addNode(new \ICalendarOrg\ZCiCalDataNode("SUMMARY:Event 1"));
...
$eventobj2 = new \ICalendarOrg\ZCiCalNode("VEVENT", $icalobj->curnode);
$eventobj2->addNode(new \ICalendarOrg\ZCiCalDataNode("SUMMARY:Event 2"));
...

$icalobj = new \ICalendarOrg\ZCiCal($icalstring);

$icalobj = null;
$eventcount = 0;
$maxevents = 500;
do
{
	$icalobj = new \ICalendarOrg\ZCiCal($icalstring, $maxevents, $eventcount);
	...
	$eventcount += $maxevents;
}
while($icalobj->countEvents() >= $eventcount);

foreach($icalobj->tree->child as $node)
{
	if($node->getName() == "VEVENT")
	{
		foreach($node->data as $key => $value)
		{
			if($key == "SUMMARY")
			{
				echo "event title: " . $value->getValues() . "\n";
			}
		}
	}
}