scortes/calendar 问题修复 & 功能扩展

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

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

scortes/calendar

最新稳定版本:v1.0.0

Composer 安装命令:

composer require scortes/calendar

包简介

Monthly Event Calendar

README 文档

README

License Latest Stable Version Dependency Status

Install

composer require scortes/calendar

Calendar

  1. Add events - every event needs to have date, content of event is completely up to you (it can be string, object, …)
  2. Optionally you can set min/max dates in dateStart/dateEnd. Otherwise they are automatically calculated.
  3. Display calendar, you can use helper function \Scortes\Calendar\HTML\monthsToTables for classic calendar.
// configure calendar
$request = new \Scortes\Calendar\CalendarRequest();
$request->dateStart = new DateTime('now - 2 month');
$request->dateEnd = null; // use max date from events
$request->events = [
    "now - 1 month" => 'Day in previous month',
    date('Y-n-') . 1 => 'First day in month',
    date('Y-n-') . 16 => '16th day in month',
    "now + 1 month" => 'Day in next month',
];
$request->addEvent(new DateTime('now + 2 months'), 'now + 2 months');

// build calendar
$calendar = Scortes\Calendar\createCalendar($request);

// display calendar
\Scortes\Calendar\HTML\monthsToTables(
    $calendar,
    array(
        'hideMonthsWithoutEvent' => true,
        'selectors' => array(
            'table' => ' class=calendar',
            'month' => ' id=currentMonth',
            'week' => ' id=currentWeek',
            'day' => ' id=today',
        ),
        'monthName' => function (Scortes\Calendar\Month\Month $month, $monthId) {
            return "<h3{$monthId}>Month {$month->monthNumber}/{$month->year}</h3>";
        },
        'day' => array(
            'withEvent' => function ($event, $currentDay) {
                return "<strong title='{$event}'>{$currentDay}</strong>";
            },
            'withoutEvent' => function ($currentDay) {
                return "<strong>{$currentDay}</strong>";
            },
            'empty' => '<td class="noDay">&nbsp;</td>'
        )
    )
);

Components

Calendar consist of two independent components:

Analyze months between two DateTimes

$dateStart = new DateTime('now - 1 month');
$dateEnd = new DateTime('now + 2 months');
$months = \Scortes\Calendar\createMonthsInterval($dateStart, $dateEnd);
Year Month Days Count Weeks Count First Day of Week First Week Number
2015 7 31 5 3 27
2015 8 31 6 6 31
2015 9 30 5 2 36
2015 10 31 5 4 40

### Data structure for events (trie separated by delimiter)

$events = new \Scortes\Calendar\Events\Events(' ');
$events->set('John', 'John');
$events->set('John Doe', 'John Doe');
$events->set('John Black', 'John Black');
$events->set('John Black', 'Another John Black');
$events->set('Paul Carter', 'Paul Carter');

$events->get('John Doe'); // John Doe
$events->get('John Black'); // [John Black, Another John Black]
$events->iterate('John'); // [John, John Doe, [John Black, Another John Black]]

Contributing

Contributions from others would be very much appreciated! Send pull request/issue. Thanks!

License

Copyright (c) 2015 Scortes. MIT Licensed, see LICENSE for details.

scortes/calendar 适用场景与选型建议

scortes/calendar 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 192 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 08 月 24 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 192
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 20
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-08-24