laravel-enso/calendar
Composer 安装命令:
composer require laravel-enso/calendar
包简介
Calendar and event management for Laravel Enso
README 文档
README
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, andYearlyfrequencies. - Supports recurrence update scopes:
Only This,This And Future, andAll. - Generates and reshapes recurring sequences through dedicated create, update, delete, and extraction services.
- Exposes a builtin readonly Birthday calendar sourced from
Personrecords. - 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.indexGET /api/core/calendar/create->core.calendar.createPOST /api/core/calendar->core.calendar.storeGET /api/core/calendar/{calendar}/edit->core.calendar.editPATCH /api/core/calendar/{calendar}->core.calendar.updateDELETE /api/core/calendar/{calendar}->core.calendar.destroyGET /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.indexGET /api/core/calendar/events/create->core.calendar.events.createPOST /api/core/calendar/events->core.calendar.events.storeGET /api/core/calendar/events/{event}/edit->core.calendar.events.editPATCH /api/core/calendar/events/{event}->core.calendar.events.updateDELETE /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:
OnceDailyWeekdaysWeeklyMonthlyYearly
Supported recurrence update scopes:
Only ThisThis And FutureAll
Reminder
LaravelEnso\Calendar\Models\Reminder
Key methods and scopes:
send()scopeNotSent()scopeOverdue()scopeShouldSend()
Custom Calendar Contracts
LaravelEnso\Calendar\Contracts\CalendarLaravelEnso\Calendar\Contracts\CustomCalendarLaravelEnso\Calendar\Contracts\ProvidesEventLaravelEnso\Calendar\Contracts\Routable
The builtin BirthdayCalendar is the reference implementation for readonly custom calendars.
Event Payload
The event resource returned to the frontend includes:
idtitleparentIdisLastbodystartendlocationfrequencyrecurrenceEndsallDayreadonlyclassroutedeletableresizable
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:
laravel-enso/core↗laravel-enso/dynamic-methods↗laravel-enso/enums↗laravel-enso/forms↗laravel-enso/helpers↗laravel-enso/mails↗laravel-enso/migrator↗laravel-enso/people↗laravel-enso/permissions↗laravel-enso/rememberable↗laravel-enso/select↗laravel-enso/track-who↗laravel-enso/users↗
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 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 laravel-enso/calendar 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A modern PHP library for generating iCalendar v2.0 events
Библиотека для реализаций паттерна Pub/Sub
Wireless Cross-Component Communication
A powerful event calendar Tool for Laravel's Nova 5.
Check for holidays - localeaware
Command bus implementation: Commands and domain events
统计信息
- 总下载量: 40.3k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-03-26