packagist spatie/calendar-links 2.0

11 hours ago

Release Notes: v2.0

See upgrade guide.

Breaking Changes

  • PHP 8.3+ required — minimum PHP version bumped from 8.1 to 8.3
  • $from and $to are now DateTimeImmutable — previously DateTime
  • Link properties are now public readonly — $title, $from, $to, and $allDay are public readonly; $description and $address are public. The magic __get() method has been removed.
  • Link::create() no longer accepts $allDay parameter — use Link::createAllDay() for all-day events instead
  • Link::createAllDay() end date semantics changed — the $numberOfDays parameter now represents inclusive days (e.g., createAllDay('Event', $date, 1) creates a single-day event). The constructor now internally adds +1
    day to convert to the exclusive end date expected by calendar services.
  • Link constructor is now final — subclassing the constructor is no longer possible; use static factory methods
  • InvalidLink::invalidDateRange() removed — the deprecated method has been deleted; use InvalidLink::negativeDateRange() instead
  • BaseOutlook::baseUrl() visibility changed — from public to protected
  • WebOffice and WebOutlook classes are now final
  • Generator constants are now typed — e.g., const string FORMAT_HTML = 'html' (PHP 8.3 typed constants)
  • Instance properties replaced with class constants — $dateFormat, $dateTimeFormat in Google, Yahoo, and BaseOutlook are now private const values, preventing override via subclassing

New Features

  • Custom ICS PRODID — the Ics generator now accepts a PRODID option to customize the product identifier in generated ICS content
  • Link::createAllDay() returns static — previously returned self, now supports late static binding for subclasses

Bug Fixes

  • All-day events off by one day — fixed all-day events created via the constructor being 1 day short
  • ICS DTSTAMP RFC 5545 compliance — DTSTAMP now always uses UTC datetime for all-day events (previously used date-only format)
  • ICS DTSTART for all-day events — added VALUE=DATE parameter to DTSTART for all-day events per RFC 5545
  • ICS escape string RFC 5545 compliance — escapeString() now properly handles backslashes, semicolons, commas, and newlines per RFC 5545 section 3.3.11 (previously used addcslashes which was non-compliant)
  • ICS VALARM trigger fix — fixed reminder/alert not working when a specific date was set as the trigger time

Internal / Code Quality

  • declare(strict_types=1) added to all source files
  • Modern PHP 8.3+ features: typed class constants, #[\Override] attributes
  • DateTimeImmutable used throughout instead of mutable DateTime
  • PHPUnit #[Test] attributes replace @test annotations
  • PSR-12 coding style applied
  • Psalm upgraded to v6.15 with improved type annotations (@api, non-empty-string, non-empty-list)
  • Removed unnecessary clone calls thanks to immutable date objects

Made by @alies-dev and the community.

Full Changelog: 1.11.1...2.0

Don't miss a new calendar-links release

NewReleases is sending notifications on new releases.