First, let me explain the requirements what I have to do.
I'm working with Laravel project. Laravel project will provide a webcal URL to users. The user will subscribe that calendar in google calendar by Add URL feature. Now, when any events get updated in Laravel project, it should also be reflected in google calendar.
Now, what's the issue I'm facing.
The user is successfully subscribing the calendar. But on updating any event, that update is not getting reflected in google calendar. I know it will not reflect soon. We have to wait till google check for updates (I think it's one day). But I have to set that time period in the calendar file (e.g, 1 hour). So google calendar should check for updates for every one hour.
Some points which I know (I'm not sure either those are correct or wrong)
webcal://
, not http://
What I have done
I have created a URL (i.e, https://example.com/icalendar) which returns .ics file
Here is the code (I have used https://github.com/markuspoerschke/iCal package)
$prodID = 'https://example.com/icalendar';
$vCalendar = new Calendar($prodID);
$vCalendar->setName('PlanetX Leaves');
$vCalendar->setPublishedTTL('PT1H');
$vEvent = new Event('EVENT1ID');
$vEvent
->setDtStart(new \DateTime('2018-11-06'))
->setDtEnd(new \DateTime('2018-11-06'))
->setSummary('Test Event 1')
->setNoTime(true);
$vCalendar->addComponent($vEvent);
$vEvent = new Event('EVENT2ID');
$vEvent
->setDtStart(new \DateTime('2018-11-14'))
->setDtEnd(new \DateTime('2018-11-16'))
->setSummary('Event 2')
->setNoTime(true);
$vCalendar->addComponent($vEvent);
return response($vCalendar->render())->withHeaders([
'Content-Type' => 'text/calendar; charset=utf-8',
'Content-Disposition' => 'attachment; filename="example-calendar.ics"',
]);
The user is subscribing the calendar by webcal://example.com/icalendar
URL. The calendar is getting subscribed successfully. But the issue is I google calendar checks for the update per day. I have to set that time 1 Hour. I have googled and also searched over stackoverflow. But I'm not finding any way for it. If any one knows the answer, it will be appreciated.