tanthammar/recurring
Composer 安装命令:
composer require tanthammar/recurring
包简介
Laravel Eloquent RRULE tools
README 文档
README
This package adds Eloquent helpers for Simshauns php Recurr package
Installation
You can install the package via composer:
composer require tanthammar/recurring
Important
start_atandend_atare expected to be stored in its timezone, not converted to utc in db. TheBuilderwill convert them using the timezone attribute.end_atrepresents DURATION not last recurrence, src: simshaun/recurr#44
Usage
Let's say you have a DatePattern model in your codebase.
The Builder parses them in combination with the timezone attribute.
Your model must have the following attributes:
protected $casts = [ 'start_at' => 'immutable_date', //required 'end_at' => 'immutable_date', //nullable, represents duration, not last recurrence 'timezone' => 'string', //required 'str_rule' => 'string', //required 'except_on' => 'array', //array with excluded dates ];
Apply the IsRecurring trait to the model
class DatePattern extends Model { use IsRecurring; //... }
After saving a string rrule to the str_rule field, you'll have access to the following methods.
For further information about additional methods see https://github.com/simshaun/recurr
All RecurrenceCollection methods returns max 732 recurrences. (Same as parent simshaun/recurr package).
Use the $count parameter to set how many recurrences you want returned.
$dp = App\Models\DatePattern::first(); $dp->recurr()->first(): bool|Recurrence $dp->recurr()->firstStart(): bool|Carbon $dp->recurr()->firstEnd(): bool|Carbon $dp->recurr()->last(): bool|Recurrence $dp->recurr()->lastStart(): bool|Carbon $dp->recurr()->lastEnd(): bool|Carbon $dp->recurr()->next(): bool|Recurrence $dp->recurr()->nextStart(): bool|Carbon $dp->recurr()->nextEnd(): bool|Carbon $dp->recurr()->current(): bool|Recurrence $dp->recurr()->currentStart(): bool|Carbon $dp->recurr()->currentEnd(): bool|Carbon $dp->recurr()->rule(): Rule $dp->recurr()->all(): RecurrenceCollection, //limited to 732 recurrences $dp->recurr()->schedule(?int $count): RecurrenceCollection $dp->recurr()->scheduleBetween(string|DateTime $startDate, string|DateTime $endDate, ?int $count): RecurrenceCollection $dp->recurr()->scheduleBefore(string|DateTime $beforeDate, ?int $count): RecurrenceCollection $dp->recurr()->scheduleAfter(string|DateTime $afterDate, ?int $count): RecurrenceCollection
Contributing
Happy for every contribution, make a PR :)
License
The MIT License (MIT). Please see License File for more information.
tanthammar/recurring 适用场景与选型建议
tanthammar/recurring 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9.5k 次下载、GitHub Stars 达 7, 最近一次更新时间为 2022 年 04 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「recurring」 「rrule」 「tanthammar」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 tanthammar/recurring 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tanthammar/recurring 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 tanthammar/recurring 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A simple Laravel 5 service provider for including the Recurly PHP client.
Rich payment solutions for zend framework2. Paypal, payex, authorize.net, be2bill, omnipay, recurring paymens, instant notifications and many more
MaxAl Subscriptions is a flexible plans and subscription management system for Laravel, with the required tools to run your SAAS like services efficiently. It's simple architecture, accompanied by powerful underlying to afford solid platform for your business.
PHP library for working with recurrence rules
Unravels a ICAL RRULE. STILL IN DEVELOPMENT.
Rinvex Subscriptions is a flexible plans and subscription management system for Laravel, with the required tools to run your SAAS like services efficiently. It's simple architecture, accompanied by powerful underlying to afford solid platform for your business.
统计信息
- 总下载量: 9.5k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-04-20