承接 horde/itip 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

horde/itip

Composer 安装命令:

composer require horde/itip

包简介

iTip invitation response library

README 文档

README

horde/itip is a pure decision engine for iTIP (RFC 5546) scheduling. It processes incoming iCalendar messages with METHOD (REQUEST, REPLY, CANCEL) and returns structured results describing what should change, without performing any I/O.

Installation

composer require horde/itip

Requires PHP 8.1+.

Architecture

Design Principles

  • Pure logic, no side effects — the engine returns decisions, not mutations
  • App applies results — the calling application decides what to persist and when to dispatch events
  • Transport-agnostic — email (iMIP), CalDAV, ActiveSync are listener concerns, not engine concerns
  • PSR-14 ready — domain events are dispatched by the app layer via horde/eventdispatcher

Layers

Layer Namespace Purpose
Engine Horde\Itip ItipProcessor, ItipMessage, ItipResult
Interfaces Horde\Itip CalendarState, SchedulingPolicy
Changes Horde\Itip\Change Proposed calendar mutations (CreateEvent, UpdateEvent, CancelEvent, etc.)
Actions Horde\Itip\Action Required outbound actions (SendReply, SendRequest, SendCancel)
Conflicts Horde\Itip\Conflict Problems detected (OutdatedSequence, UnknownAttendee, MissingRequiredProperty)
Events Horde\Itip\Event PSR-14 domain events for listener dispatch
Generators Horde\Itip\Generator Build outgoing METHOD=REQUEST/REPLY/CANCEL VCalendar messages

Processing Flow

Incoming VCalendar with METHOD
        │
        ▼
  ItipMessage::fromCalendar()
        │
        ▼
  ItipProcessor::process()
        │  - validates required properties
        │  - checks SEQUENCE ordering
        │  - consults CalendarState for existing data
        │  - consults SchedulingPolicy for decisions
        │
        ▼
  ItipResult
        │  - changes[]    (what should be persisted)
        │  - actions[]    (what should be sent)
        │  - conflicts[]  (why processing failed)
        │
        ▼
  Application applies changes, then dispatches PSR-14 events
        │
        ▼
  Listeners handle transport (iMIP, CalDAV, logging)

Boundaries

This library is responsible for:

  • Deciding what calendar mutations an iTIP message implies
  • Validating SEQUENCE ordering and required properties
  • Consulting application-provided policy for accept/reject decisions
  • Generating outbound iTIP VCalendar messages (REQUEST, REPLY, CANCEL)
  • Defining PSR-14 event types for scheduling notifications

This library is not responsible for:

  • Parsing iCalendar byte streams. See horde/icalendar
  • Sending email (iMIP/MIME construction), relegated to the upcoming horde/imip package
  • Persisting data. This is handled by application layers (Kronolith, Nag)
  • CalDAV schedule-outbox/inbox. See horde/dav
  • Event dispatch itself. The app layer calls $dispatcher->dispatch()

Collaboration Partners

Package Relationship
horde/icalendar Provides VCalendar, Vevent, Attendee, Organizer, and open enums consumed by the engine
horde/eventdispatcher PSR-14 dispatcher used by apps to notify listeners after applying results
horde/imip (planned) Will listen for PSR-14 events and handle MIME email construction/delivery
horde/dav CalDAV layer that may feed iTIP messages into the engine and act on results
Kronolith / Nag Application layers that implement CalendarState and SchedulingPolicy

Upcoming: horde/imip

A separate horde/imip package will handle the iMIP (RFC 6047) transport layer:

  • Listens for InvitationSending, ReplySending, CancellationSending PSR-14 events
  • Constructs MIME messages with text/calendar parts
  • Delivers via configured mail transport
  • Parses incoming iMIP messages from mailbox into ItipMessage for processing

This separation keeps horde/itip transport-free and testable without email infrastructure.

Upgrading

See doc/UPGRADING.md for migration guidance from Horde_Itip (PSR-0) to the modern Horde\Itip (PSR-4) engine.

Usage

Processing an Incoming Request

use Horde\Itip\ItipMessage;
use Horde\Itip\ItipProcessor;
use Horde\Itip\NullCalendarState;
use Horde\Itip\DefaultSchedulingPolicy;
use Horde\Itip\Change\CreateEvent;
use Horde\Itip\Change\UpdateEvent;

$processor = new ItipProcessor(
    new MyCalendarState($calendarBackend),  // implements CalendarState
    new DefaultSchedulingPolicy(),
);

$message = ItipMessage::fromCalendar($vcalendar, 'me@example.com');
$result = $processor->process($message);

if ($result->hasConflicts()) {
    // Handle conflicts (outdated sequence, missing properties, etc.)
    foreach ($result->conflicts as $conflict) { ... }
    return;
}

// Apply proposed changes
foreach ($result->changes as $change) {
    match (true) {
        $change instanceof CreateEvent => $backend->create($change->event),
        $change instanceof UpdateEvent => $backend->update($change->uid, $change->updatedEvent),
        // ...
    };
}

// Dispatch PSR-14 event for listeners (iMIP, logging, etc.)
$dispatcher->dispatch(new InvitationReceived($message, $result));

Generating an Outbound Reply

use Horde\Icalendar\Enum\ParticipationStatus;

$replyCal = $processor->generateReply(
    $existingEvent,
    'me@example.com',
    ParticipationStatus::from('ACCEPTED'),
);

// $replyCal is a VCalendar with METHOD=REPLY, ready for transport

Implementing CalendarState

use Horde\Itip\CalendarState;
use Horde\Icalendar\Calendar\Vevent;
use Horde\Icalendar\Enum\ParticipationStatus;

class KronolithCalendarState implements CalendarState
{
    public function findEventByUid(string $uid): ?Vevent { ... }
    public function getAttendeeStatus(string $uid, string $email): ?ParticipationStatus { ... }
    public function getEventSequence(string $uid): ?int { ... }
}

Legacy horde/itip lib/ content

The package ships with its legacy, largely horde 5 compatible API to tie into the horde/icalendar legacy lib/ API. This older API mixes iTip and iMip concerns.

License

LGPL-2.1 — see LICENSE.

horde/itip 适用场景与选型建议

horde/itip 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.16k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2023 年 12 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「invitations」 「itip」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 horde/itip 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 horde/itip 我们能提供哪些服务?
定制开发 / 二次开发

基于 horde/itip 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.16k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 11
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 5
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-2.1-only
  • 更新时间: 2023-12-04