iCal-creator for PHP - This package offers an abstraction layer for creating iCalendars files

Overview

📅 eluceo — iCal 2

Continuous Integration codecov Psalm coverage License Latest Stable Version Monthly Downloads Infection MSI

This package offers an abstraction layer for creating iCalendars files. By using this PHP package, you can create *.ics files without the knowledge of the underling format. The output itself will follow RFC 5545 as good as possible.

Navigate through the project

Installation

You can install this package by using Composer, running the following command:

composer require eluceo/ical

Version / Upgrade

The initial version was released back in 2012. The version 2 of this package is a complete rewrite of the package and is not compatible to older version. Please see the upgrade guide if you want to migrate from version 0.* to 2.*. If you just start using this package, you should install version 2.

Version PHP Version
2.* 7.4 - 8.0
0.16.* 7.0 - 8.0
0.11.* 5.3.0 - 7.4

Documentation

Visit ical.poerschke.nrw for complete documentation.

Usage

The classes within this package are grouped into two namespaces:

  • The Domain contains the information about the events.
  • The Presentation contains the transformation from Domain into a *.ics file.

To create a calendar, the first step will be to create the corresponding domain objects. Then these objects can be transformed into a iCalendar PHP representation, which can be cast to string.

Empty event

In this very basic example, that renders an empty event. You will learn how to create an event domain object, how to add it to a calendar and how to transform it to a iCalendar component.

1. Create an event domain entity

$event = new \Eluceo\iCal\Domain\Entity\Event();

2. Create a calendar domain entity

$calendar = new \Eluceo\iCal\Domain\Entity\Calendar([$event]);

3. Transform calendar domain object into a presentation object

$iCalendarComponent = (new \Eluceo\iCal\Presentation\Factory\CalendarFactory())->createCalendar($calendar);

4. a) Save to file

file_put_contents('calendar.ics', (string) $iCalendarComponent);

4. b) Send via HTTP

header('Content-Type: text/calendar; charset=utf-8');
header('Content-Disposition: attachment; filename="cal.ics"');

echo $iCalendarComponent;

Full example

The following example will create a single day event with a summary and a description. More examples can be found in the examples/ folder.



require_once __DIR__ . '/../vendor/autoload.php';

// 1. Create Event domain entity
$event = (new Eluceo\iCal\Domain\Entity\Event())
    ->setSummary('Christmas Eve')
    ->setDescription('Lorem Ipsum Dolor...')
    ->setOccurrence(
        new Eluceo\iCal\Domain\ValueObject\SingleDay(
            new Eluceo\iCal\Domain\ValueObject\Date(
                \DateTimeImmutable::createFromFormat('Y-m-d', '2030-12-24')
            )
        )
    );

// 2. Create Calendar domain entity
$calendar = new Eluceo\iCal\Domain\Entity\Calendar([$event]);

// 3. Transform domain entity into an iCalendar component
$componentFactory = new Eluceo\iCal\Presentation\Factory\CalendarFactory();
$calendarComponent = $componentFactory->createCalendar($calendar);

// 4. Set headers
header('Content-Type: text/calendar; charset=utf-8');
header('Content-Disposition: attachment; filename="cal.ics"');

// 5. Output
echo $calendarComponent;

License

This package is released under the MIT license.

Comments
  • Generated ical not importing events in outlook

    Generated ical not importing events in outlook

    Reference to this issue on stackoverflow: http://stackoverflow.com/questions/43249331/outlook-web-app-is-not-importing-events-from-my-generated-icalendar

    When a student wants to subscribe to his or her calender, we generate an URL which can be filled into Google Calender and Outlook. Except the last mentioned outlook it isn't importing any events.

    Example of how our generated ICS looks like. This contains 1 event with the description of 'test'.

    BEGIN:VCALENDAR 
    VERSION:2.0 
    PRODID:www.onderwijsonline.nl 
    X-PUBLISHED-TTL:PT15M 
    BEGIN:VEVENT 
    UID:58e5f21fc2551 
    DTSTART;TZID=Europe/Amsterdam:20170406T090000 
    SEQUENCE:0 
    TRANSP:OPAQUE DTEND;TZID=Europe/Amsterdam:20170406T140000 URL:http://oo.dev/calendar/event/420 
    SUMMARY:Test 
    CLASS:PUBLIC 
    DTSTAMP:20170406T094535Z 
    END:VEVENT 
    END:VCALENDAR
    

    The script that calls the package to generate this:

    public function getIcal($token = null)
        {
            $user = $this->userRepository->getByToken($token);
    
            $vCalendar = new \Eluceo\iCal\Component\Calendar('www.onderwijsonline.nl');
            $vCalendar->setPublishedTTL('PT15M');
    
            if (!is_null($user)) {
    
                /**
                 * Calendar events
                 */
                $events = $this->calendarRepository->getEventsForUser($user->id, Carbon::now()->subWeeks(2), Carbon::now()->addWeeks(6));
                foreach ($events as $event) {
    
                    $vEvent = new \Eluceo\iCal\Component\Event();
    
                    $vEvent
                        ->setUseTimezone(true)
                        ->setUseUtc(false)
                        ->setDtStart(Carbon::parse($event['start']))
                        ->setDtEnd(Carbon::parse($event['end']))
                        ->setNoTime(($event['allDay'] == 1 ? true : false))
                        ->setUrl($event['href'])
                        ->setDescription($event['description'])
                        ->setSummary($event['title']);
    
                    $vCalendar->addComponent($vEvent);
                }
    
                /**
                 * Project events
                 */
                $events = $this->calendarRepository->getEventsForProjects($user->id, null, null);
    
                foreach ($events as $event) {
                    $vEvent = new \Eluceo\iCal\Component\Event();
    
                    $vEvent
                        ->setUseTimezone(true)
                        ->setUseUtc(false)
                        ->setDtStart(Carbon::parse($event['start']))
                        ->setDtEnd(Carbon::parse($event['end']))
                        ->setNoTime(($event['allDay'] == 1 ? true : false))
                        ->setUrl($event['href'])
                        ->setSummary($event['title']);
    
                    $vCalendar->addComponent($vEvent);
                }
    
                /**
                 * Timetable events
                 */
                $events = $this->calendarRepository->getEventsForTimetables($user->id, Carbon::now()->subWeeks(2), Carbon::now()->addWeeks(6));
                foreach ($events as $event) {
                    $vEvent = new \Eluceo\iCal\Component\Event();
    
                    $vEvent
                        ->setUseTimezone(true)
                        ->setUseUtc(false)
                        ->setDtStart(Carbon::parse($event['start']))
                        ->setDtEnd(Carbon::parse($event['end']))
                        ->setNoTime(($event['allDay'] == 1 ? true : false))
                        ->setSummary($event['title']);
    
                    $vCalendar->addComponent($vEvent);
                }
            }
    
            header('Content-Type: text/calendar; charset=utf-8');
            header('Content-Disposition: inline; filename=onderwijsonline.ics');
    
            return $vCalendar->render();
        }
    

    As I've mentioned above, this exact setup works fine for Google Calendar, but is not for outlook.

    bug question 
    opened by KevinHoughton 12
  • Is there a way to change sync frequency?

    Is there a way to change sync frequency?

    I have imported the cal generated by this package to outlook and it says that it will sync once in 168 hours, due to the limit set by the calendar provider. Is there a way to change this ?

    question 
    opened by naneri 11
  • Do not escape new lines (

    Do not escape new lines ("\n")

    According to rfc5545 (https://tools.ietf.org/html/rfc5545.html#section-3.1): "Content lines are delimited by a line break, which is a CRLF sequence (CR character followed by LF character)."

    I also tested the behaviour in Apple Calender. When using \n the line break is registered when using \\n like the lib currently does it is not registered.

    Maybe this change should only apply to the description field. I'm not sure about this.

    opened by djschilling 7
  • Adding 4 days in end date if no time is true

    Adding 4 days in end date if no time is true

    There is an issue which is caused on the following conditions:

    $event = new Event('some UID') $event->setDtStart($startDate); $event->setDtEnd($endDate); $event->setNoTime(true);

    What is the point of adding 1 day to the end date if no time is true? https://github.com/markuspoerschke/iCal/blob/master/src/Component/Event.php#L261

    This line gets executed 4 times and increases the end date by 4 days.

    bug 
    opened by piyushkantm 7
  • fixes all day events and adds getter for `Event::getDtStart`

    fixes all day events and adds getter for `Event::getDtStart`

    All day events should always end the next day. Additionally the tzid should not be applied to all day events.

    And added a missing getDtStart getter function to the Event component.

    enhancement feature 
    opened by buggedcom 7
  • Allow new lines in event descriptions

    Allow new lines in event descriptions

    I'm pretty sure that description is allowed to contain new lines: https://tools.ietf.org/html/rfc5545#page-85

    I took at pass at implementing this, but I'm happy to do it a different way.

    opened by jrjohnson 7
  • Calendar app on the Mac does not accept this ics.

    Calendar app on the Mac does not accept this ics.

    When i try to import a downloaded .ics file with this content, no calendar item is imported in the calendar

    BEGIN:VCALENDAR PRODID:platform VERSION:2.0 CALSCALE:GREGORIAN BEGIN:VEVENT UID:94b10624-55ac-4974-b87d-48408e89a841 DTSTAMP:20220302T084901Z SUMMARY:testx DESCRIPTION:Join: https://test.nl DTSTART;UTC=:20220303T083800 DTEND;TZID=UTC:20220303T093800 ORGANIZER:mailto:test%40test.io SEQUENCE:0 DURATION:P0DT1H0M0S END:VEVENT END:VCALENDAR

    Are there any suggestions?

    opened by csmeets 6
  • Bump infection/infection from 0.23.0 to 0.25.5

    Bump infection/infection from 0.23.0 to 0.25.5

    Bumps infection/infection from 0.23.0 to 0.25.5.

    Release notes

    Sourced from infection/infection's releases.

    0.25.5

    Added:

    Changed:

    bypass-finals conflic, automatic XDEBUG_MODE=coverage, stop Infection execution on empty git diff filter

    Added:

    Changed:

    Ignore mutations by regex for uncovered mutants

    Fixed:

    • ignoreSourceCodeByRegex option is ignored between // @codeCoverageIgnoreStart and // @codeCoverageIgnoreEnd #1561

    Avoid parser bugs for very large negative numbers

    Fixed:

    • Avoid parser bugs for very large negative numbers #1580

    Count syntax errors caused by a mutatan as a failure of a mutant

    Added:

    • Count syntax errors caused by a mutatan as a failure of a mutant #1571

    Performance improvements, running killing tests first; JSON schema for autocomplete of config file; detecting syntax errors

    0.25.0 (2021-09-06)

    Full Changelog

    Added:

    • Detect syntax errors during mutation analysis and differentiate them from all errors #1555 #262
    • Add $schema to generated infection.json config file for autocomplete #1553 #1432

    Changed:

    ... (truncated)

    Changelog

    Sourced from infection/infection's changelog.

    Change Log

    Full Changelog

    0.25.4 (2021-12-08)

    Added:

    Changed:

    0.25.0 (2021-09-05)

    Full Changelog

    Added:

    • Detect syntax errors during mutation analysis and differentiate them from all errors #1555 #262
    • Add $schema to generated infection.json config file for autocomplete #1553 #1432

    Changed:

    • [Performance] Add files to coverage whitelist instead of the whole directories when --filter or --git-diff-filter are used #1543
    • [Performance] Speed up Infection runs by remembering which test killed a mutant #1519 #1549
    • [internal] Allow Infection test suite to be executed in parallel using Paratest #1544
    • Generate infection.json (without .dist postfix) by default #1554
    • Do not mark Mutant as Killed when no tests were executed #1546

    Fixed:

    • Display time and consumed memory even in case of insufficient MSI #1562
    • Trim "\n" and "\t" characters when replacing relative paths with absolute ones during XML config creation #1550 #1542
    • For Mutant's phpunit.xml, set executionOrder="default" to prevent random ordering of the tests since we need them to be sorted (fastest - first) #1547

    0.24.0 (2021-07-25)

    Full Changelog

    Added:

    • [Mutator] Add Mutator SpreadAssignment #1529
    • [Mutator] Add Mutator SpreadRemoval #1529

    Changed:

    ... (truncated)

    Commits
    • 6844063 fix: adjust signature of inherited method (#1616)
    • 497bd4a Upgrade PHPStan version (#1614)
    • 666baa5 Code improvements for PHPStan v1 (#1613)
    • 17a3d98 Show ignored mutants on progress and summary (#1612)
    • 616b406 Do not run Infection for itself on windows (#1611)
    • 9885adf Use explicit e2e-runner and test PHAR on PHP 8.0 with Xdebug (#1610)
    • adc3256 Use InstalledVersions::getPrettyVersion() to have 1.0.2 instead of `1.0.2...
    • 88dae3c Update CHANGELOG.md for 0.25.4
    • a9e7c20 Allow Symfony 6 (#1606)
    • f60fbc5 Add dg/bypass-finals to the conflict packages list (#1605)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.

    Dependabot will merge this PR once CI passes on it, as requested by @markuspoerschke-bot.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies php 
    opened by dependabot[bot] 6
  • Last day not shown in calendar?

    Last day not shown in calendar?

    Hi,

    my iCal is delivered like this:

    BEGIN:VEVENT
    UID:5916c2b4da9d7
    DTSTART;TZID=Europe/Berlin;VALUE=DATE:20170630
    SEQUENCE:0
    TRANSP:OPAQUE
    DTEND;TZID=Europe/Berlin;VALUE=DATE:20170702
    LOCATION:My Location
    SUMMARY:My Summary
    CLASS:PUBLIC
    X-MICROSOFT-CDO-ALLDAYEVENT:TRUE
    DTSTAMP:20170513T102420Z
    END:VEVENT
    
    

    The problem is, that my calendar shows the event from 06/30/2017 to 07/01/2017 instead of 07/02/2017. Why does the last day is missing or what did I wrong?

    Thank you, Marc

    question 
    opened by kaju74 6
  • Problem with GEO property when importing into Google Calendar

    Problem with GEO property when importing into Google Calendar

    It seems as if the Google Calendar does not support the GEO property that was added with commit 7a3751f615fb4c53ccf174de7ff167f0b62da6b8 (this is also addressed in pull request #66). Importing an event with a GEO property fails in Google Calendar.

    There should be an option to disable the GEO property because setting the geo location works perfectly for iOS and Mac using the X-APPLE-STRUCTURED-LOCATION property.

    opened by sgehrig 6
  • Consider implementing X-MICROSOFT-CDO-BUSYSTATUS

    Consider implementing X-MICROSOFT-CDO-BUSYSTATUS

    We sometimes need to specify out-of-office (X-MICROSOFT-CDO-BUSYSTATUS:OOF) for the status, but this library doesn't support it at the moment. I don't know if this can be implemented as part of $event->setStatus or if it would need to be a separate new property. If this can't be implemented, is there a way to set a custom property manually?

    enhancement 
    opened by barrymieny 6
  • Bump friendsofphp/php-cs-fixer from 3.4.0 to 3.13.1

    Bump friendsofphp/php-cs-fixer from 3.4.0 to 3.13.1

    Bumps friendsofphp/php-cs-fixer from 3.4.0 to 3.13.1.

    Release notes

    Sourced from friendsofphp/php-cs-fixer's releases.

    v3.13.1 Oliva

    • bug: Align all the arrows inside the same array (#6590)
    • bug: Fix priority between modernize_types_casting and no_unneeded_control_parentheses (#6687)
    • bug: TrailingCommaInMultilineFixer - do not add trailing comma when there is no break line after last element (#6677)
    • docs: Fix docs for disabled rules in rulesets (#6679)
    • docs: fix the cookbook_fixers.rst (#6672)
    • docs: Update installation recommended commands for mkdir argument (-p insteadof --parents). (#6689)
    • Make static data providers that are not using dynamic calls (#6696)
    • minor: displaying number of checked files (#6674)

    v3.13.0 Oliva

    • bug: BracesFixer - Fix unexpected extra blank line (#6667)
    • bug: fix CI on master branch (#6663)
    • bug: IsNullFixer - handle casting (#6661)
    • docs: feature or bug (#6652)
    • docs: Use case insensitive sorting for options (#6666)
    • docs: [DateTimeCreateFromFormatCallFixer] Fix typos in the code sample (#6671)
    • DX: update cli-executor (#6664)
    • DX: update dev-tools (#6665)
    • feature: Add global_namespace_import to @​Symfony ruleset (#6662)
    • feature: Add separate option for closure_fn_spacing (#6658)
    • feature: general_phpdoc_annotation_remove - allow add case_sensitive option (#6660)
    • minor: AllowedValueSubset - possible values are sorted (#6651)
    • minor: Use md5 for file hashing to reduce possible collisions (#6597)

    v3.12.0 Oliva

    • bug: SingleLineThrowFixer - Handle throw expression inside block (#6653)
    • DX: create TODO to change default ruleset for v4 (#6601)
    • DX: Fix SCA findings (#6626)
    • DX: HelpCommand - fix docblock (#6584)
    • DX: Narrow some docblock types (#6581)
    • DX: Remove redundant check for PHP <5.2.7 (#6620)
    • DX: Restore PHPDoc to type rules workflow step (#6615)
    • DX: SCA - scope down types (#6630)
    • DX: Specify value type in iterables in tests (#6594)
    • DX: Test on PHP 8.2 (#6558)
    • DX: Update GitHub Actions (#6606)
    • DX: Update PHPStan (#6616)
    • feature: Add @PHP82Migration ruleset (#6621)
    • feature: ArrayPushFixer now fix short arrays (#6639)
    • feature: NoSuperfluousPhpdocTagsFixer - support untyped and empty annotations in phpdoc (#5792)
    • feature: NoUselessConcatOperatorFixer - Introduction (#6447)
    • feature: Support for constants in traits (#6607)
    • feature: [PHP8.2] Support for new standalone types (null, true, false) (#6623)
    • minor: GitHub Workflows security hardening (#6644)
    • minor: prevent BC break in ErrorOutput (#6633)
    • minor: prevent BC break in Runner (#6634)
    • minor: Revert "minor: prevent BC break in Runner" (#6637)
    • minor: Update dev tools (#6554)

    ... (truncated)

    Changelog

    Sourced from friendsofphp/php-cs-fixer's changelog.

    Changelog for v3.13.1

    • bug: Align all the arrows inside the same array (#6590)
    • bug: Fix priority between modernize_types_casting and no_unneeded_control_parentheses (#6687)
    • bug: TrailingCommaInMultilineFixer - do not add trailing comma when there is no break line after last element (#6677)
    • docs: Fix docs for disabled rules in rulesets (#6679)
    • docs: fix the cookbook_fixers.rst (#6672)
    • docs: Update installation recommended commands for mkdir argument (-p insteadof --parents). (#6689)
    • Make static data providers that are not using dynamic calls (#6696)
    • minor: displaying number of checked files (#6674)

    Changelog for v3.13.0

    • bug: BracesFixer - Fix unexpected extra blank line (#6667)
    • bug: fix CI on master branch (#6663)
    • bug: IsNullFixer - handle casting (#6661)
    • docs: feature or bug (#6652)
    • docs: Use case insensitive sorting for options (#6666)
    • docs: [DateTimeCreateFromFormatCallFixer] Fix typos in the code sample (#6671)
    • DX: update cli-executor (#6664)
    • DX: update dev-tools (#6665)
    • feature: Add global_namespace_import to @​Symfony ruleset (#6662)
    • feature: Add separate option for closure_fn_spacing (#6658)
    • feature: general_phpdoc_annotation_remove - allow add case_sensitive option (#6660)
    • minor: AllowedValueSubset - possible values are sorted (#6651)
    • minor: Use md5 for file hashing to reduce possible collisions (#6597)

    Changelog for v3.12.0

    • bug: SingleLineThrowFixer - Handle throw expression inside block (#6653)
    • DX: create TODO to change default ruleset for v4 (#6601)
    • DX: Fix SCA findings (#6626)
    • DX: HelpCommand - fix docblock (#6584)
    • DX: Narrow some docblock types (#6581)
    • DX: Remove redundant check for PHP <5.2.7 (#6620)
    • DX: Restore PHPDoc to type rules workflow step (#6615)
    • DX: SCA - scope down types (#6630)
    • DX: Specify value type in iterables in tests (#6594)
    • DX: Test on PHP 8.2 (#6558)
    • DX: Update GitHub Actions (#6606)
    • DX: Update PHPStan (#6616)
    • feature: Add @PHP82Migration ruleset (#6621)
    • feature: ArrayPushFixer now fix short arrays (#6639)
    • feature: NoSuperfluousPhpdocTagsFixer - support untyped and empty annotations in phpdoc (#5792)
    • feature: NoUselessConcatOperatorFixer - Introduction (#6447)
    • feature: Support for constants in traits (#6607)
    • feature: [PHP8.2] Support for new standalone types (null, true, false) (#6623)

    ... (truncated)

    Commits
    • 78d2251 prepared the 3.13.1 release
    • a2bdba3 Make static data providers that are not using dynamic calls (#6696)
    • ad0a87e bug: Align all the arrows inside the same array (#6590)
    • 663f3fc docs: Update installation recommended commands for mkdir argument (-p ins...
    • 9c7070b bug: Fix priority between modernize_types_casting and `no_unneeded_control_...
    • 046ff90 docs: Fix docs for disabled rules in rulesets (#6679)
    • b577444 minor: displaying number of checked files (#6674)
    • bb94db0 bug: TrailingCommaInMultilineFixer - do not add trailing comma when there is ...
    • 3969f39 docs: fix the cookbook_fixers.rst (#6672)
    • a1a5570 bumped version
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.

    Dependabot will merge this PR once CI passes on it, as requested by @markuspoerschke-bot.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies php 
    opened by dependabot[bot] 2
  • Fix formatting UTC date time

    Fix formatting UTC date time

    Rather than setting TZID=UTC, date times that are using UTC must end with the Z letter.

    Wrong: DTSTART;TZID=UTC:20220812T090000 Correct: DTSTART;20220812T090000Z

    Fixes: #462 Fixes: #263

    bug 
    opened by markuspoerschke 0
  • Invalid iCal generated when DateTimeZone is UTC

    Invalid iCal generated when DateTimeZone is UTC

    Code to reproduce:

    $startDate = new DateTime();
    $startDate->setTimezone(new \DateTimeZone('UTC'));
    $endDate = new DateTime();
    $endDate->setTimezone(new \DateTimeZone('UTC'));
    $start = new \Eluceo\iCal\Domain\ValueObject\DateTime($startDate, true);
    $end = new \Eluceo\iCal\Domain\ValueObject\DateTime($endDate, true);
    $occurence = new \Eluceo\iCal\Domain\ValueObject\TimeSpan($start, $end);
    $vEvent->setOccurrence($occurence);
    

    This generates iCal that contains properties like this:

    DTSTART;TZID=UTC:20220812T090000
    DTEND;TZID=UTC:20220812T103000
    

    However TZID=UTC is not allowed according to the specs: The "TZID" property parameter MUST NOT be applied to DATE properties and DATE-TIME or TIME properties whose time values are specified in UTC.

    When this iCal export is passed to an iCal Validatior, it will fail with validation errors.

    If I create the DateTime instace with $applyTimeZone = false:

    $start = new \Eluceo\iCal\Domain\ValueObject\DateTime($startDate, false);
    $end = new \Eluceo\iCal\Domain\ValueObject\DateTime($endDate, false);
    

    This will create iCal without the "Z" suffix for UTC timestamps:

    DTSTART:20220812T090000
    DTEND:20220812T103000
    

    Which results in wrong start and end times when imported into a calendar application.

    I think the correct format shold look like this:

    DTSTART:20220812T090000Z
    DTEND:20220812T103000Z
    

    Is there any option to get iCal properties like this?

    Thank you!

    bug 
    opened by janpawellek 0
  • ICS and calendar agent causing a lot of requests for past events on my asp.net mvc endpoint

    ICS and calendar agent causing a lot of requests for past events on my asp.net mvc endpoint

    Does anyone using iCal know how to fix this?

    https://stackoverflow.com/questions/73024648/ics-and-calendar-agent-causing-a-lot-of-requests-for-past-events-on-my-asp-net-m

    opened by cblaze22 0
  • No exist Method property in EventFactory

    No exist Method property in EventFactory

    Please add in next release the propertie METHOD in Event, for example with value REQUEST.

    yield new Property('METHOD', new TextValue("REQUEST"));

    opened by morojosa 2
Releases(2.9.0)
  • 2.9.0(Dec 23, 2022)

    Changed

    • Add missing return types and missing template annotations #472
    • Added @implements IteratorAggregate<Event> to \Eluceo\iCal\Domain\Collection\Events
    • Added @implements IteratorAggregate<ContentLine> to \Eluceo\iCal\Presentation\Component
    • Added @return Traversable<ContentLine> to \Eluceo\iCal\Presentation\Component::getIterator
    • Fix EmailAddress value object: do not url encode email addresses #479
    Source code(tar.gz)
    Source code(zip)
  • 2.8.0(Dec 22, 2022)

  • 2.7.0(Jun 21, 2022)

  • 0.17.0(Jun 18, 2022)

  • 2.6.0(Jun 17, 2022)

  • 2.5.1(Apr 26, 2022)

  • 2.5.0(Feb 13, 2022)

  • 2.4.0(Dec 13, 2021)

  • 2.3.0(Aug 24, 2021)

  • 2.2.0(May 3, 2021)

  • 2.1.0(Apr 22, 2021)

    Fixed

    • TZOFFSETTO and TZOFFSETFROM should never be -0000 #246
    • Calling TimeZone::createFromPhpDateTimeZone with default values fails with assertion #250

    Deprecated

    • Method Eluceo\iCal\Domain\Entity\TimeZone::createFromPhpDateTimeZone will not have default values for $beginDateTime and $endDateTime in the next major version. #250
    Source code(tar.gz)
    Source code(zip)
  • 2.0.0(Mar 29, 2021)

    This version is complete rewrite. Please check the upgrade guide on how to upgrade from version 0.* to 2.0.0.

    Added

    • Support for PHP 8.0.

    Changed

    • Separate domain and presentation logic

    Removed

    • Support for PHP <=7.3
    Source code(tar.gz)
    Source code(zip)
  • 0.16.1(Oct 4, 2020)

  • 0.16.0(Dec 29, 2019)

  • 0.15.1(Aug 6, 2019)

  • 0.15.0(Jan 13, 2019)

  • 0.11.6(Apr 30, 2018)

    Version0.11.5 was tagged on wrong branch.

    This is the PHP 5 compatible version. If you are using PHP 7 you want to use the latest 0.14 (or newer) version.

    Source code(tar.gz)
    Source code(zip)
  • 0.14.0(Mar 13, 2018)

  • 0.11.5(Mar 13, 2018)

  • 0.13.0(Oct 26, 2017)

    Changed

    • Improve performance for long lines. By using mbstring the folding of lines is much faster and consumes less CPU and memory. #103
    • In UTC mode the time will be converted to UTC timezone. #106
    Source code(tar.gz)
    Source code(zip)
  • 0.11.4(Oct 26, 2017)

    Changed

    • Improve performance for long lines. By using mbstring the folding of lines is much faster and consumes less CPU and memory. #104

    Thanks to @stchr for this change! 👍

    Source code(tar.gz)
    Source code(zip)
  • 0.12.1(Jun 7, 2017)

  • 0.12.0(May 10, 2017)

    IMPORTANT: Please note that this release contains breaking changes.

    Fixed

    • Do not escape value of the GEO property #79

    Added

    • Add support for \DateTimerInterface. This allows to use \DateTimeImmutable. #86
    • Add support for arbitrary time zone strings. #87,#89
    • Add new Geo property class #79

    Changed

    • Drop support for old PHP versions: 5.3, 5.4, 5.6
    • Remove default value for X-PUBLISHED-TTL. This value controls the update interval if the ics file is synced. The former default value was set to one week. If you want the behavior from version < 0.12 you have to set the value: $vCalendar->setPublishedTTL('P1W'). #81

    Removed

    • Remove class \Eluceo\iCal\Property\Event\Description #61
    • Remove class \Eluceo\iCal\Util\PropertyValueUtil #61
    Source code(tar.gz)
    Source code(zip)
  • 0.11.3(Apr 25, 2017)

  • 0.11.2(Apr 20, 2017)

  • 0.11.1(Apr 4, 2017)

  • 0.11.0(Sep 16, 2016)

    Added

    • Allow multiple recurrence rules in an event #77
    • RecurrenceRule now also allows hourly, minutely and secondly frequencies #78

    Deprecated

    • Adding a single recurrence rule to an event using Event::setRecurrenceRule() is deprecated and will be removed in 1.0. Use Event::addRecurrenceRule() instead. #77
    Source code(tar.gz)
    Source code(zip)
  • 0.10.1(Jun 9, 2016)

  • 0.10.0(Apr 26, 2016)

    Changed

    • Use 'escapeValue' to escape the new line character. #60
    • Order components by type when building ical file. #65

    Added

    • X-ALT-DESC for HTML types with new descriptionHTML field. #55
    • Added a property and setter for calendar color. #68
    • Write also GEO property if geo location is given. #66
    Source code(tar.gz)
    Source code(zip)
  • 0.9.0(Nov 13, 2015)

    • Add CHANGELOG.md based on ’Keep a CHANGELOG’
    • Allow new lines in event descriptions #53
    • Breaking Change: Changed signature of the Event::setOrganizer method. Now there is is only one parameter that must be an instance of Property\Organizer.
    • Updated install section in README.md #54
    • Added support for event properties EXDATE and RECURRENCE-ID #50
    Source code(tar.gz)
    Source code(zip)
Owner
Markus Poerschke
Hello! I am a software engineer.
Markus Poerschke
A package which provides a monthly calendar with days and events depending on given months and events.

A package which provides a monthly calendar with days and events depending on given months and events. This is where your description should go. Try a

MichaB 6 Nov 1, 2022
A simple PHP API extension for DateTime.

Carbon An international PHP extension for DateTime. http://carbon.nesbot.com <?php use Carbon\Carbon; printf("Right now is %s", Carbon::now()->toDat

Brian Nesbitt 16k Dec 30, 2022
Parse, validate, manipulate, and display dates in PHP w/ i18n support. Inspired by moment.js

Support I am a dad now for the last 1,5 years and that clearly shows in being on time with merging PRs or pushing this package further. Time is the bi

Tino Ehrich 944 Dec 21, 2022
The easy PHP Library for calculating holidays

Introduction Yasumi (Japanese for 'Holiday'「休み」) is the easy PHP library that helps you retrieve the dates and names of holidays and other special cel

AzuyaLabs 926 Dec 29, 2022
The missing PHP 5.3+ calendar management library.

CalendR CalendR is an Object Oriented Calendar management library on top of PHP5.3+ Date objects. You can use it to deal with all your needs about cal

Yohan Giarelli 462 Dec 30, 2022
Date Manager PHP Class

Date Manager PHP Class Date Manager Version 1.0.0 PHP class for date management, for example converting solar date to gregorian date and vice versa. C

Alireza Tolouei 2 Dec 21, 2021
CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due

The PHP cron expression parser can parse a CRON expression, determine if it is due to run, calculate the next run date of the expression, and calculate the previous run date of the expression. You can calculate dates far into the future or past by skipping n number of matching dates.

Chris Tankersley 4.3k Jan 9, 2023
Parse and validate crontab expressions in PHP

Standard (V7) compliant crontab expression parser/validator with support for time zones; see "man 5 crontab" for possible expressions.

René Pollesch 42 Dec 14, 2022
This library helps PHP users to convert and using Jalali DateTime format

Easy Jalali for PHP V1.0.0 Jalali calendar converter for Persian users in Iran, Afghanistan and other countries that use Jalali calendar. Very thanks

Majid J 3 Mar 20, 2022
PHP library that provides a filesystem abstraction layer − will be a feast for your files!

Gaufrette Gaufrette provides a filesystem abstraction layer. Why use Gaufrette? Imagine you have to manage a lot of medias in a PHP project. Lets see

KNP Labs 2.4k Jan 7, 2023
Offers tools for creating pdf files.

baldeweg/pdf-bundle Offers tools for creating pdf files. Getting Started composer req baldeweg/pdf-bundle Activate the bundle in your config/bundles.p

André Baldeweg 0 Oct 13, 2022
:zap: Simple Cache Abstraction Layer for PHP

⚡ Simple Cache Class This is a simple Cache Abstraction Layer for PHP >= 7.0 that provides a simple interaction with your cache-server. You can define

Lars Moelleken 27 Dec 8, 2022
Spot v2.x DataMapper built on top of Doctrine's Database Abstraction Layer

Spot DataMapper ORM v2.0 Spot v2.x is built on the Doctrine DBAL, and targets PHP 5.4+. The aim of Spot is to be a lightweight DataMapper alternative

Spot ORM 602 Dec 27, 2022
:gem: Simple MySQLi Abstraction Layer + Doctrine/DBAL support

?? Simple MySQLi Class This is a simple MySQL Abstraction Layer compatible with PHP 7+ that provides a simple and secure interaction with your databas

Lars Moelleken 40 Sep 5, 2022
Doctrine Database Abstraction Layer

Doctrine DBAL 4.0-dev 3.0 2.13 N/A N/A Powerful database abstraction layer with many features for database schema introspection, schema management and

Doctrine 8.9k Dec 28, 2022
Lightweight abstraction layer for payment gateways

Slickpay is lightweight abstraction layer for payment gateways. Documentation Documentation for Slickpay can be found on official website. Licence The

Slickpay 31 Oct 26, 2021
Simple cache abstraction layer implementing PSR-16

sabre/cache This repository is a simple abstraction layer for key-value caches. It implements PSR-16. If you need a super-simple way to support PSR-16

sabre.io 48 Sep 9, 2022
Database Abstraction Layer, Schema Introspection, Schema Generation, Query Builders

Cycle DBAL Secure, multiple SQL dialects (MySQL, PostgreSQL, SQLite, SQLServer), schema introspection, schema declaration, smart identifier wrappers,

Cycle ORM 30 Oct 18, 2022
An abstraction layer for easily implementing industry-standard caching strategies

Laravel Model Repository This package provides an abstraction layer for easily implementing industry-standard caching strategies with Eloquent models.

null 44 Dec 31, 2022
Spot v2.x DataMapper built on top of Doctrine's Database Abstraction Layer

Spot DataMapper ORM v2.0 Spot v2.x is built on the Doctrine DBAL, and targets PHP 5.4+. The aim of Spot is to be a lightweight DataMapper alternative

Spot ORM 602 Dec 27, 2022