PHP Classes

PHP ICS Calendar Reader: Parse iCalendar ics files to extract event details

Recommend this page to a friend!
  Info   Example   Screenshots   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 1,187 All time: 3,194 This week: 41Up
Version License PHP version Categories
ical-ics-php-reader 1.4.1MIT/X Consortium ...5.4PHP 5, Time and Date, Parsers
Description 

Author

This class can parse iCalendar ICS files to extract event details.

It can take a string with event data in the ICS format and parses it to extract details of the described events.

The class returns an associative array with all the details of the calendar like the program that generated, the program version, original time zone of the creator, as well the details of the events like the date and time of start and end, summary, description, etc..

Picture of Pablo Matias Perrone
  Performance   Level  
Name: Pablo Matias Perrone <contact>
Classes: 5 packages by
Country: Argentina Argentina
Age: 46
All time rank: 136017 in Argentina Argentina
Week rank: 215 Up4 in Argentina Argentina Up
Innovation award
Innovation award
Nominee: 1x

Example

<?php
include ( 'iCalEasyReader.php' );
$ical = new iCalEasyReader();
$lines = $ical->load( file_get_contents( 'example.ics' ) );

var_dump( $lines );


Details

iCalEasyReader

Usage:

<?php
header( 'Content-Type: text/plain; charset=UTF-8' );
include ( 'iCalEasyReader.php' );
$ical = new iCalEasyReader();
$lines = $ical->load( file_get_contents( 'example2.ics' ) );
var_dump( $lines );
?>

Output:

array(4) {
	["PRODID"]=>
	string(48) "-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN"
	["VERSION"]=>
	string(3) "2.0"
	["VTIMEZONE"]=>
	array(3) {
		[0]=>
		array(2) {
			["TZID"]=>
			string(13) "Europe/Berlin"
			["X-LIC-LOCATION"]=>
			string(13) "Europe/Berlin"
		}
		["DAYLIGHT"]=>
		array(1) {
			[0]=>
			array(5) {
				["TZOFFSETFROM"]=>
				string(5) "+0100"
				["TZOFFSETTO"]=>
				string(5) "+0200"
				["TZNAME"]=>
				string(4) "CEST"
				["DTSTART"]=>
				string(15) "19700329T020000"
				["RRULE"]=>
				array(3) {
					["FREQ"]=>
					string(6) "YEARLY"
					["BYDAY"]=>
					string(4) "-1SU"
					["BYMONTH"]=>
					string(1) "3"
				}
			}
		}
		["STANDARD"]=>
		array(1) {
			[0]=>
			array(5) {
				["TZOFFSETFROM"]=>
				string(5) "+0200"
				["TZOFFSETTO"]=>
				string(5) "+0100"
				["TZNAME"]=>
				string(3) "CET"
				["DTSTART"]=>
				string(15) "19701025T030000"
				["RRULE"]=>
				array(3) {
					["FREQ"]=>
					string(6) "YEARLY"
					["BYDAY"]=>
					string(4) "-1SU"
					["BYMONTH"]=>
					string(2) "10"
				}
			}
		}
	}
	["VEVENT"]=>
	array(1) {
		[0]=>
		array(9) {
			["CREATED"]=>
			string(16) "20140107T092011Z"
			["LAST-MODIFIED"]=>
			string(16) "20140107T121503Z"
			["DTSTAMP"]=>
			string(16) "20140107T121503Z"
			["UID"]=>
			string(36) "20f78720-d755-4de7-92e5-e41af487e4db"
			["SUMMARY"]=>
			string(11) "Just a Test"
			["DTSTART"]=>
			array(2) {
				["value"]=>
				string(15) "20140102T110000"
				["TZID"]=>
				string(13) "Europe/Berlin"
			}
			["DTEND"]=>
			array(2) {
				["value"]=>
				string(15) "20140102T120000"
				["TZID"]=>
				string(13) "Europe/Berlin"
			}
			["X-MOZ-GENERATION"]=>
			string(1) "4"
			["DESCRIPTION"]=>
			&string(2298) "Here is a new Class:

Screenshots (1)  
  • example2.png
  Files folder image Files (7)  
File Role Description
Accessible without login Plain text file iCalEasyReader.readme.md Doc. Readme file
Plain text file iCalEasyReader.php Class iCalEasyReader class file
Accessible without login Plain text file iCalEasyReader.example.php Example usage example
Accessible without login Plain text file output.example2.txt Output Output of example2.ics
Accessible without login Plain text file example.ics Data ICS file example
Accessible without login Plain text file example2.ics Data ICS file example 2

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:1,187
This week:0
All time:3,194
This week:41Up
User Comments (1)
Thanks!
4 years ago (Ebay Michel)
80%StarStarStarStarStar