laravel-enso/calendar 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

laravel-enso/calendar

Composer 安装命令:

composer require laravel-enso/calendar

包简介

Calendar and event management for Laravel Enso

README 文档

README

License Stable Downloads PHP Issues Merge Requests

Description

Calendar adds calendar and event management to Laravel Enso.

The package supports persisted calendars and events, recurring event sequences, attendees, reminders, all-day events, and custom readonly calendar sources that can project data from outside the calendar_events table.

It also ships with a builtin Birthday calendar, reminder notifications delivered through mail, database, and broadcast channels, plus the backend API and form metadata consumed by the Enso calendar frontend.

Installation

This package is normally installed as part of the Enso ecosystem.

For standalone installation in an Enso-based application:

composer require laravel-enso/calendar

Optional publishes:

php artisan vendor:publish --tag=calendar-provider
php artisan vendor:publish --tag=calendar-config
php artisan vendor:publish --tag=calendar-mail
php artisan vendor:publish --tag=calendar-factories

Birthday calendar configuration:

return [
    'birthdays' => [
        'roles' => ['*'],
    ],
];

The package also registers the reminder command:

php artisan enso:calendar:send-reminders

Features

  • Manages calendars with configurable colors and privacy flags.
  • Manages events with title, body, location, attendees, reminders, geocoordinates, and all-day support.
  • Supports recurring events with Once, Daily, Weekdays, Weekly, Monthly, and Yearly frequencies.
  • Supports recurrence update scopes: Only This, This And Future, and All.
  • Generates and reshapes recurring sequences through dedicated create, update, delete, and extraction services.
  • Exposes a builtin readonly Birthday calendar sourced from Person records.
  • Allows registering additional custom calendars that return readonly event projections.
  • Sends overdue reminders through queued mail, database, and broadcast notifications.
  • Registers reminder mail previews through laravel-enso/mails.
  • Registers form metadata and API resources used by the Enso calendar frontend.

Usage

Create and manage native calendars and events through the provided API routes, or register custom readonly calendars through the published provider:

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use App\Calendars\OrdersCalendar;

class CalendarServiceProvider extends ServiceProvider
{
    protected array $register = [
        OrdersCalendar::class,
    ];
}

A custom calendar must implement LaravelEnso\Calendar\Contracts\CustomCalendar and return event objects that implement LaravelEnso\Calendar\Contracts\ProvidesEvent.

To dispatch due reminders manually:

php artisan enso:calendar:send-reminders

::: tip Tip Use custom calendars for readonly projections coming from other bounded contexts. If users need to create or edit the events themselves, store them as native Calendar and Event records instead. :::

::: warning Note Reminder notifications depend on Laravel's scheduler. If the scheduler is not running, overdue reminders will remain pending until enso:calendar:send-reminders is executed. :::

API

Commands

  • enso:calendar:send-reminders

Calendar Routes

All routes are registered under the core.calendar. name prefix and /api/core/calendar path prefix.

  • GET /api/core/calendar -> core.calendar.index
  • GET /api/core/calendar/create -> core.calendar.create
  • POST /api/core/calendar -> core.calendar.store
  • GET /api/core/calendar/{calendar}/edit -> core.calendar.edit
  • PATCH /api/core/calendar/{calendar} -> core.calendar.update
  • DELETE /api/core/calendar/{calendar} -> core.calendar.destroy
  • GET /api/core/calendar/options -> core.calendar.options

Event Routes

Event routes are registered under the core.calendar.events. name prefix.

  • GET /api/core/calendar/events -> core.calendar.events.index
  • GET /api/core/calendar/events/create -> core.calendar.events.create
  • POST /api/core/calendar/events -> core.calendar.events.store
  • GET /api/core/calendar/events/{event}/edit -> core.calendar.events.edit
  • PATCH /api/core/calendar/events/{event} -> core.calendar.events.update
  • DELETE /api/core/calendar/events/{event} -> core.calendar.events.destroy

Models

Calendar

LaravelEnso\Calendar\Models\Calendar

Key relations:

  • events()

Exposed state:

  • name()
  • color()
  • private()
  • readonly()

Event

LaravelEnso\Calendar\Models\Event

Key relations:

  • parent()
  • events()
  • attendees()
  • calendar()
  • reminders()

Key methods:

  • store(?int $updateType = null)
  • remove(?int $updateType)
  • attendeeList()
  • updateReminders($reminders)

Supported frequencies:

  • Once
  • Daily
  • Weekdays
  • Weekly
  • Monthly
  • Yearly

Supported recurrence update scopes:

  • Only This
  • This And Future
  • All

Reminder

LaravelEnso\Calendar\Models\Reminder

Key methods and scopes:

  • send()
  • scopeNotSent()
  • scopeOverdue()
  • scopeShouldSend()

Custom Calendar Contracts

  • LaravelEnso\Calendar\Contracts\Calendar
  • LaravelEnso\Calendar\Contracts\CustomCalendar
  • LaravelEnso\Calendar\Contracts\ProvidesEvent
  • LaravelEnso\Calendar\Contracts\Routable

The builtin BirthdayCalendar is the reference implementation for readonly custom calendars.

Event Payload

The event resource returned to the frontend includes:

  • id
  • title
  • parentId
  • isLast
  • body
  • start
  • end
  • location
  • frequency
  • recurrenceEnds
  • allDay
  • readonly
  • class
  • route
  • deletable
  • resizable

Validation Rules

The event request validates:

  • calendar membership
  • supported frequency ids
  • start and end dates
  • start and end times
  • attendee ids
  • recurrence end dates
  • update scope

It also prevents:

  • recurring metadata on singular events
  • invalid subsequence backdating when updating future events

Configuration

config/enso/calendar.php

Keys:

  • birthdays.roles

Depends On

Required Enso packages:

Companion frontend package:

Contributions

are welcome. Pull requests are great, but issues are good too.

Thank you to all the people who already contributed to Enso!

laravel-enso/calendar 适用场景与选型建议

laravel-enso/calendar 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 40.3k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2019 年 03 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 laravel-enso/calendar 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 3
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-03-26