Skip to content

πŸ“† Create easily a full iCalendar subscription service. Compatible with the best Calendar Apps, Laravel and Composer.

License

Notifications You must be signed in to change notification settings

bvanhoekelen/icalendar-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

33 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“† PHP iCalendar simple parser tool πŸ› 

Hex.pm GitHub release Packagist Github issues

composer require bvanhoekelen/icalendar-php

Highlight

  • Generate simpel ical sub

Example

<?php

require_once('../vendor/autoload.php');

use Calendar\Element\Calendar;
use Calendar\Type\Location;
use Calendar\Type\Geo;

$calender = (new Calendar())
	->setColor('#00A677')
	->setName('Custom name')
	->setDescription('Custom description')
	->setRefreshInterval('P1H')
;

// Add Event
$calender->newEvent()
	->setDtStart(new DateTime('now'))
	->setDtEnd(new DateTime('+1 day'))
	->setDtStamp(new DateTime('now'))
	->setSummary('short summary of the event')
	->setDescription('full description of the event')
	->setUrl('https://www.google.nl')
	// Add Location
	->setLocationWizard(((new Location())
		->setTitle('Koninklijk Paleis Amsterdam')
		->setStreetAddress('Nieuwezijds Voorburgwal 147')
		->setZipCode('1012 RJ')
		->setCity('Amsterdam')
		->setCountry('Nederland')
		->setGeo(new Geo(52.373149,4.891342))
	))
	// Add organizer
	->setOrganizerWizard('Bart', 'exemple@gmail.com')
	// Add attended
	->setAttendee((new Attendee())
		->wizard(Attendee::PARTSTAT_ACCEPTED, 'Bart', 'exemple@gmail.com')
	)
	->setAttendee((new Attendee())
		->wizard(Attendee::PARTSTAT_ACCEPTED, 'Henk', 'exemple2@gmail.com')
	)
	// Add repeat
	->setRepeatRule((new RepeatRule(RepeatRule::FREQ_YEARLY))
		->setByDay(RepeatRule::BYDAY_TH)
		->setBySetPos(RepeatRule::BYSETPOS_FIRST)
		->setByMonth(RepeatRule::BYMONTH_NOV)
		->setCount(7)
	)
;

// Render to string with headers
echo $calender->serve();

See more examples.

Help, docs and links

About

πŸ“† Create easily a full iCalendar subscription service. Compatible with the best Calendar Apps, Laravel and Composer.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages