PHP code example of crusherrl / ics-link-generator

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

    

crusherrl / ics-link-generator example snippets


use CrusherRL\IcsLinksGenerator;

// ...

$start = '2025-08-15 15:00:00'; //  optional
$location = 'any location'; // optional
$description = 'Let\'s talk about this stuff'; // optional
$allDay = 'false'; // optional - NOTE: it should be true or false as string, since we urlencode this, it would be converted to 0 (false) or 1 (true)

// Building base for the generator

$generator = new IcsLinksGenerator($start, $end, $summary, $location, $description, $allDay);
// OR
$generator = IcsLinksGenerator::make(['DTSTART' => $start, 'DTEND' => $end]);
// OR Like from an URL!
$generator = IcsLinksGenerator::fromUrl('https://example.com/create-event?summary=Meeting&description=Discuss+project&location=Office&start=20250430T100000Z&end=20250430T110000Z')
// OR Like from an URL but the query is base64 encoded
$generator = IcsLinksGenerator::fromUrl('https://example.com/create-event?c3VtbWFyeT1NZWV0aW5nJmRlc2NyaXB0aW9uPURpc2N1c3MrcHJvamVjdCZsb2NhdGlvbj1PZmZpY2Umc3RhcnQ9MjAyNTA0MzBUMTAwMDAwWiZlbmQ9MjAyNTA0MzBUMTEwMDAwWg');

// Actual Generating the urls
// Generating all possible urls
$urls = $generator->generate();

// Generating only specific urls
$urls = $generator->generateSpecific([IcsLinksGenerator::YAHOO, IcsLinksGenerator::AOL, IcsLinksGenerator::OUTLOOK_MOBILE]);

use CrusherRL\IcsLinksGenerator;

// ...

$generator->setLabels([IcsLinksGenerator::OUTLOOK => 'Outlook.com']);

use CrusherRL\IcsLinksGenerator;

// ...

// Actual Generating the urls
// Generating all possible urls
$urls = $generator->generate(false);

// Generating only specific urls
$urls = $generator->generateSpecific([IcsLinksGenerator::YAHOO, IcsLinksGenerator::AOL, IcsLinksGenerator::OUTLOOK_MOBILE], false);

// OR you can get url only, like this
$aol = $generator->makeAOLUrl();
$yahoo = $generator->makeYahooUrl();
$google = $generator->makeGoogleUrl();
$office = $generator->makeOfficeUrl();
$officeMobile = $generator->makeOfficeMobileUrl();
$outlook = $generator->makeOutlookUrl();
$outlookMobile = $generator->makeOutlookMobileUrl();