1. Go to this page and download the library: Download spatie/calendar-links 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/ */
spatie / calendar-links example snippets
use Spatie\CalendarLinks\Link;
Link::create(
'Birthday party',
new DateTime('2027-03-15 10:00', new DateTimeZone('Europe/Brussels')),
new DateTime('2027-03-15 17:00', new DateTimeZone('Europe/Brussels')),
)->google();
use Spatie\CalendarLinks\Link;
$from = new DateTime('2027-03-15 10:00', new DateTimeZone('Europe/Brussels'));
$to = new DateTime('2027-03-15 17:00', new DateTimeZone('Europe/Brussels'));
$link = Link::create('Birthday party', $from, $to)
->description('A full day of hands-on testing. Bring a laptop.')
->address('Samberstraat 69D, 2060 Antwerp, Belgium');
// A link that creates the event on Google calendar
echo $link->google();
// A link that creates the event on Yahoo calendar
echo $link->yahoo();
// A link that creates the event on outlook.live.com
echo $link->webOutlook();
// A link that creates the event on outlook.cloud.microsoft
echo $link->webOffice();
// A data URI holding an ics file, for iCal, Apple Calendar and Outlook
echo $link->ics();
// The raw ics body instead of a data URI, to attach to an email as a file
echo $link->ics([], ['format' => 'file']);
// Any generator of your own
echo $link->formatWith(new \Your\Generator());
$flight = Link::create(
'NH 106 Tokyo to Los Angeles',
new DateTime('2027-03-15 09:00', new DateTimeZone('Asia/Tokyo')),
new DateTime('2027-03-15 09:30', new DateTimeZone('America/Los_Angeles')),
);