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 = '2023-08-15 15:00:00'; // nal
$location = 'locationHey!'; // optional
$description = 'descriptionHey!'; // 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]);

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

// Generating only specific urls
$urls = $generator->generateSpecific(['yahoo', 'aol', 'outlook_mobile']);

use CrusherRL\IcsLinksGenerator;

// ...

$generator->setLabels(['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(['yahoo', 'aol', '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();