2017 © Pedro Peláez
 

library ical-bundle

Create ics url or file for Symfony 2

image

bomo/ical-bundle

Create ics url or file for Symfony 2

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 17 Forks
  • 0 Open issues
  • 13 Versions
  • 4 % Grown

The README.md

BOMOIcalBundle

This bundle is used to create an ics file or url to populate a shared calendar with events., (*1)

Caution

Release 2.0 introduce new major version of kigkonsult., (*2)

Overview

<?php
public function getIcs()
{
    $provider = $this->get('bomo_ical.ics_provider');

    $tz = $provider->createTimezone();
    $tz
        ->setTzid('Europe/Paris')
        ->setXProp('X-LIC-LOCATION', $tz->getTzid())
        ;

    $cal = $provider->createCalendar($tz);

    $cal
        ->setName('My cal1')
        ->setDescription('Foo')
        ;

    $datetime = new \Datetime('now');
    $event = $cal->newEvent();
    $event
        ->setStartDate($datetime)
        ->setEndDate($datetime->modify('+5 hours'))
        ->setName('Event 1')
        ->setDescription('Desc for event')
        ->setAttendee('foo@bar.me')
        ->setAttendee('John Do')
        ;

    $alarm = $event->newAlarm();
    $alarm
        ->setAction('DISPLAY')
        ->setDescription($event->getDescription())
        ->setTrigger('-PT2H') //See Dateinterval string format
        ;

    // All Day event
    $event = $cal->newEvent();
    $event
        ->isAllDayEvent()
        ->setStartDate($datetime)
        ->setEndDate($datetime->modify('+10 days'))
        ->setName('All day event')
        ->setDescription('All day visualisation')
        ;

    $calStr = $cal->returnCalendar();

    return new Response(
        $calStr,
        200,
        array(
            'Content-Type' => 'text/calendar; charset=utf-8',
            'Content-Disposition' => 'attachment; filename="calendar.ics"',
        )
    );
}

Versions

  • Release 1.0: Kigkonsult 2.24
  • Release 2.0: Kigkonsult >2.24 with majors changes

Actual state

This bundle is in stable state with release 1.0;, (*3)

Installation

Add BOMOIcalBundle in your composer.json, (*4)

{
    "require": {
        "bomo/ical-bundle": "1.0.*"
    }
}

Now tell composer to download the bundle by running the step:, (*5)

``` bash $ php composer.phar update bomo/ical-bundle, (*6)


AppKernel.php ``` php $bundles = array( ... new BOMO\IcalBundle\BOMOIcalBundle(), );

User's Guide

All objects can be managed regardless by the provider. But the object need to be attached., (*7)

Event attached to Calendar, (*8)

Alarm attached to Event, (*9)

To simplify the use, the objects are a proxy method to create a child feature., (*10)

$alarm = $event->newAlarm();
$alarm
    ->set[...]
    [...]
    ;

Is stricly same that, (*11)

$alarm = $provider->createAlarm();
$alarm
    ->set[...]
    [...]
    ;
$event->attachAlarm($alarm);

Outlook compatibility

Outlook does not support the parameter "x-wr-timezone". To prevent adding it to the ics, the createCalendar has a new parameter for defining whether or not to include a Timezone in the ics., (*12)

$ical = $cal = $this->provider->createCalendar(null, true);

Object reference

Provider

Timezone function createTimezone();
Calendar function createCalendar();
Event function createEvent();
Alarm function createAlarm();

Timezone

Timezone function __construct(array $config=null);
string function getTzid();
this function setTzid($tz);
vtimezone function getTimezone();

Calendar

Calendar function __construct(array $config);
this function setName($name);
this function setDescription($desc);
Event function newEvent(); //Directly attached to this Calendar
this function attachEvent(Event $event)
string function returnCalendar();
vcalendar function getCalendar();

Event

Event function __construct(mixed $param);
this function setStartDate(Datetime $date);
this function setEndDate(Datetime $date);
this function isAllDayEvent();
this function setName($name);
this function setLocation($loc);
this function setDescription($desc);
this function setComment($comment);
this function setAttendee($attendee);
this function setOrganizer($org);
Alarm function newAlarm(); //Directly attached to this Event
this function attachAlarm(Alarm $alarm);
vevent function getEvent();

Alarm

Alarm function __construct(mixed $param);
this function setAction($action); //Currently, only 'DISPLAY' action is setted.
this function setDescription($desc);
this function setTrigger($trigger);
valarm function getAlarm();

Configuration example

Currently, this bundle doesn't required any configuration section., (*13)

The Versions

16/07 2018

1.0.x-dev

1.0.9999999.9999999-dev http://github.com/BorisMorel/IcalBundle

Create ics url or file for Symfony 2

  Sources   Download

MIT

The Requires

 

16/07 2018

dev-master

9999999-dev http://github.com/BorisMorel/IcalBundle

Create ics url or file for Symfony 2

  Sources   Download

MIT

The Requires

 

16/07 2018
08/03 2018
15/09 2017
12/06 2017
06/01 2017
23/07 2014

v1.0.5

1.0.5.0 http://github.com/BorisMorel/IcalBundle

Create ics url or file for Symfony 2

  Sources   Download

MIT

The Requires

 

26/01 2014

v1.0.4

1.0.4.0 http://github.com/BorisMorel/IcalBundle

Create ics url or file for Symfony 2

  Sources   Download

MIT

The Requires

 

09/12 2013

v1.0.3

1.0.3.0 http://github.com/BorisMorel/IcalBundle

Create ics url or file for Symfony 2

  Sources   Download

MIT

The Requires

 

07/10 2013

v1.0.2

1.0.2.0 http://github.com/BorisMorel/IcalBundle

Create ics url or file for Symfony 2

  Sources   Download

MIT

The Requires

 

04/10 2013

v1.0.1

1.0.1.0 http://github.com/BorisMorel/IcalBundle

Create ics url or file for Symfony 2

  Sources   Download

MIT

The Requires

 

02/10 2013

v1.0.0

1.0.0.0 http://github.com/BorisMorel/IcalBundle

Create ics url or file for Symfony 2

  Sources   Download

MIT

The Requires