rlanvin/php-rrule
Composer 安装命令:
composer require rlanvin/php-rrule
包简介
Lightweight and fast recurrence rules for PHP (RFC 5545)
README 文档
README
Lightweight and fast implementation of recurrence rules for PHP (RRULE from RFC 5545), to easily calculate recurring/repeating dates and events (such as in a calendar).
This library started as a port of python-dateutil.
Basic example
use RRule\RRule; $rrule = new RRule([ 'FREQ' => 'MONTHLY', 'INTERVAL' => 1, 'DTSTART' => '2015-06-01', 'COUNT' => 6 ]); foreach ($rrule as $occurrence) { echo $occurrence->format('D d M Y'),", "; } // Mon 01 Jun 2015, Wed 01 Jul 2015, Sat 01 Aug 2015, Tue 01 Sep 2015, Thu 01 Oct 2015, Sun 01 Nov 2015 echo $rrule->humanReadable(),"\n"; // monthly on the 1st of the month, starting from 01/06/2015, 6 times
Complete documentation and more examples are available in the wiki.
Requirements
- PHP >= 7.3
- intl extension is recommended for
humanReadable()but not strictly required
Installation
The recommended way is to install the lib through Composer.
Simply run composer require rlanvin/php-rrule for it to be automatically installed and included in your composer.json.
Now you can use the autoloader, and you will have access to the library:
require 'vendor/autoload.php';
Documentation
Complete documentation is available in the wiki.
You will also find useful information in the RFC 5545 section 3.3.10.
Contribution
Feel free to contribute! Just create a new issue or a new pull request.
The coding style is (mostly) PSR-2, but with tabs.
Translation
Use ./bin/review_translations.php --locale <locale> to print a list of examples using the locale specified (default is English).
Use ./bin/review_translations.php --rule "<rule>" to test a specific rule in all available locales.
Note
I started this library because I wasn't happy with the existing implementations in PHP, so I thought it would be a good learning project to port the python-dateutil rrule implementation into PHP.
The Python lib was a bit difficult to understand because the algorithms
are not commented and the variables are very opaque (I'm looking at
you lno1wkst). I tried to comment and explain as much of the algorithm as possible
in this PHP port, so feel free to check the code if you're interested.
The lib differs from the python version in various aspects, notably in the respect of the RFC. This version is a bit stricter and will not accept many non-compliant combinations of rule parts, that the python version otherwise accepts. There are also some additional features in this version.
License
This library is released under the MIT License.
rlanvin/php-rrule 适用场景与选型建议
rlanvin/php-rrule 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11.97M 次下载、GitHub Stars 达 700, 最近一次更新时间为 2015 年 06 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「date」 「recurring」 「ical」 「rrule」 「recurrence」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 rlanvin/php-rrule 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 rlanvin/php-rrule 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 rlanvin/php-rrule 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A simple Laravel 5 service provider for including the Recurly PHP client.
Tools to convert between .NET and PHP date formats
This package developed for easy integration of ics-file generating.
Endroid Calendar
Rich payment solutions for zend framework2. Paypal, payex, authorize.net, be2bill, omnipay, recurring paymens, instant notifications and many more
Laravel Eloquent RRULE tools
统计信息
- 总下载量: 11.97M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 703
- 点击次数: 31
- 依赖项目数: 41
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2015-06-30