cultuurnet/calendar-summary-v3
Composer 安装命令:
composer require cultuurnet/calendar-summary-v3
包简介
Library to convert cultuurnet dates to a readable summary
README 文档
README
Installation
composer require cultuurnet/calendar-summary-v3
How it works
This library helps with formatting calendar information as HTML or plain text for events or places from Uitdatabank.
We do this by parsing an Offer instance from JSONLD.
Types
The Offer object has a calendarType property which can have one of the four following options:
- single
- multiple
- periodic
- permanent
Parameters
There are 3 (optional) parameters which can be used on the initialisation of the formatters. Those are
- langCode
- hidePastDates
- timeZone
langCode
(string) Default value: 'nl_BE'. You can use this parameter to change the language of the output that the formatter will produce. Currently works in nl, fr, de and en. The format here is standard PHP locales. For example 'fr_BE' or 'de_BE'.
hidePastDates
(boolean) Default value: false. This parameter (when true) will only be used on offers with a calendarType 'multiple'. When true, dates in the past won't be in the formatter's output.
timeZone
(string) Default value: 'Europe/Brussels' You can set a different timezone with this parameter. Supported timezones can be found in this list.
Formats
After initializing the formatter, you call the format method with the following 2 parameters:
- Instance of the
Offerobject provided by this library - The desired output format ('xs', 'sm', 'md' or 'lg')
Using an unsupported format will throw an exception.
Example
<?php // Make sure to either deserialize the Event/Place from JSON, or set the necessary properties through setCalendarType() etc. $offer = new \CultuurNet\CalendarSummaryV3\Offer\Offer::fromJsonLd('JSONLD_STRING'); // This will format the calendar info of `$offer` in a medium HTML output $calendarHTML = new \CultuurNet\CalendarSummaryV3\CalendarHTMLFormatter('nl_BE', true, 'Europe/Brussels'); $calendarHTML->format($offer, 'md'); // This will format the calendar info of `$offer` in a large plain text output $calendarPlainText = new \CultuurNet\CalendarSummaryV3\CalendarPlainTextFormatter('fr_BE', true, 'Europe/Paris'); $calendarPlainText->format($offer, 'lg');
cultuurnet/calendar-summary-v3 适用场景与选型建议
cultuurnet/calendar-summary-v3 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 58.11k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2017 年 10 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 cultuurnet/calendar-summary-v3 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 cultuurnet/calendar-summary-v3 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 58.11k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 5
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2017-10-27