Class for iCalendar(.ics) file creation.
Is made into Laravel 4 environment as a library, but you can use it everywhere, always adding dependecies.
Dependency:
Illuminate\Filesystem\Filesystem
Create the object:
$ics = new ICS('//Company//Product//EN', array(
'startDate' => $startTimestamp,
'endDate' => $endTimestamp,
'address' => $addressString,
'summary' => $summaryString,
'uri' => $uriString,
'description' => $descriptionString
));
If you want you can contruct as required like:
$ics = new ICS('//Company//Product//EN');
$ics->startDate($startTimestamp)
->endDate($endTimestamp)
->address($addressString)
->summary($summaryString)
->uri($uriString)
->description($descriptionString);
Get the markup as string:
$ics->get();
Save file to file:
If there is no file name this will be date('Ymd', time()).
$ics->save('path/to/save', 'optional_file_name');
Also you can construct as required like:
$ics->path = 'path/to/save';
$ics->save();
You can get the file path from:
$ics->path;
Delete file:
$ics->delete();
Enjoy!