PHP code example of makinuk / icalendar

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

    

makinuk / icalendar example snippets


use Makinuk\ICalendar\Calendar;
use Makinuk\ICalendar\Component\Alarm;
use Makinuk\ICalendar\Component\Event;

$event = Event::create('Product demo', '2026-10-01 14:00', '2026-10-01 15:00')
    ->setDescription("We will walk through the new dashboard.\nQuestions are welcome.")
    ->setLocation('Meeting room 3, Istanbul')
    ->setOrganizer('[email protected]', 'Jane Doe')
    ->addAlarm(Alarm::display('Product demo')->before(minutes: 10));

$calendar = new Calendar($event);

$calendar->save('demo.ics');        // write a file
$ics = $calendar->render();         // or get the string
$calendar->send('demo.ics');        // or download it in plain PHP

use Makinuk\ICalendar\Enum\Method;
use Makinuk\ICalendar\Property\Attendee;

$event = Event::create('Quarterly planning', '2026-10-05 10:00', '2026-10-05 11:30')
    ->setOrganizer('[email protected]', 'Jane Doe')
    ->addAttendee(new Attendee('[email protected]', 'Bob Smith', rsvp: true));

$calendar = (new Calendar($event))->setMethod(Method::Request);

// Attach $calendar->render() to an e-mail with the type $calendar->getContentType().

use Makinuk\ICalendar\Enum\Weekday;
use Makinuk\ICalendar\Value\RecurrenceRule;

Event::create('Monthly review', '2026-10-30 16:00', '2026-10-30 17:00')
    ->setRecurrenceRule(RecurrenceRule::monthly()->byDay(Weekday::Friday->nth(-1)));   // last Friday

use Makinuk\ICalendar\Component\Todo;

(new Event())->setAllDay()->setStart('2026-10-29')->setSummary('Republic Day');

Todo::create('Send the quarterly report', '2026-10-15 17:00')->setPriority(1);