1. Go to this page and download the library: Download acrnogor/ical-exporter 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/ */
acrnogor / ical-exporter example snippets
// first, we need Twig environement
$loader = new Twig_Loader_Filesystem();
$twig = new Twig_Environment($loader, [
'cache' => __DIR__ . '/var/cache',
]);
// now create new ICalExporter object and download event items as ICS file
$filename = 'this-is-my-calendar.ics';
$icalExporter = new ICalExporter($twig);
$ice->downloadAsICal($items, $filename);
// you an either repeat Twig part or just use Dependency Injection (i.e. in Symfony) to inject twig to the class, then fetch it as a service
...
// now create new ICalExporter object and download event items as ICS file
$icalExporter = new ICalExporter($twig);
$icsText = $ice->getICalDataAsString($items);
echo $icsText;