PHP Classes


Recommend this page to a friend!
  Classes of Stefan Kientzler   PHP Google Calendar Add Event   Download  
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: PHP Google Calendar Add Event
Create 'Add to my google calendar' link for a page
Author: By
Last change:
Date: 2 years ago
Size: 2,291 bytes


Class file image Download

Create 'Add to my google calendar' Link to your Homepage

Latest Stable Version License Donate Minimum PHP Version Scrutinizer Code Quality


This class can generate the HREF value to provide a Add to my google calendar link to your page.

Following Data for the event to create is supported: - Subject

- `setSubject()`  
  • Start Date/Time - `setStart()`
  • End Date/Time or Duration(if not set, default duration of 30 min is used) - `setEnd()` or `setDuration()`
  • Timezone (if not set, system settings used) - `setTimezone()`
  • All day Event - `setTimezone()`
  • Detailed Description (optional) - `setDetails()`
  • Location - `setLocation()`
  • Additional Guest(s) - `addGuest()`


  1. Create an instance of the GCalAddEventLink class
  2. Set the required information for the event to be generated
  3. Pass the generated HREF to an <a> element on your page

See AddEventExample.php


This package can use any PSR-3 compliant logger. The logger is initialized with a NullLogger-object by default. The logger of your choice have to be passed to the constructor of the GCalAddEventLink class.

If you are not working with a PSR-3 compatible logger so far, this is a good opportunity to deal with this recommendation and may work with it in the future.

There are several more or less extensive PSR-3 packages available on the Internet.

You can also take a look at the 'XLogger' package and the associated blog 'PSR-3 logging in a PHP application' as an introduction to this topic.


2020-12-15 Version 1.00

* initial Version