Hello,
i'd like to develop a plugin that reads an iCalendar/ics file and provide the events for further processing/displaying.
As a first step I have created the plugin skeleton as described in the tutorial here: https://learn.getgrav.org/plugins/plugin-tutorial
But I have absolutely no idea how I can add existing libraries to my new plugin as I only have very little experience with PHP and even less with things like composer.
I'd like to use either https://github.com/OzzyCzech/icalparser or https://github.com/u01jmg3/ics-parser. I already got the first one running in a simple PHP script:
<?php
require ('src/IcalParser.php');
$cal = new \om\IcalParser();
$results = $cal->parseFile('events.ics');
foreach ($cal->getSortedEvents() as $r) {
echo sprintf('<li>%s - %s</li>'.PHP_EOL, $r['DTSTART']->format('j.n.Y'), $r['SUMMARY']);
}
But how do I properly embed it in my plugin?
Best regards,
Michael