applicazza/appointed
Composer 安装命令:
composer require applicazza/appointed
包简介
Check whether required appointment slot is open or offer closest available one
README 文档
README
Installation
composer require applicazza/appointed
Usage
- Set up default timezone, i.e.
date_default_timezone_set('Asia/Jerusalem');
- Instantiate business day
use Applicazza\Appointed\BusinessDay; // ... $business_day = new BusinessDay;
- Create some operating periods and add them to business day. If some operating periods cannot be added then false will be returned and no changes will be applied whatsoever
use Applicazza\Appointed\Period; // ... $period_0900_1400 = Period::make(today( 9, 00), today(14, 00)); $period_1600_1900 = Period::make(today(16, 00), today(19, 00)); $business_day->addOperatingPeriods( $period_1600_1900, $period_0900_1400 );
- Create some appointments and add them to business day. If some appointments cannot be added then false will be returned and no changes will be applied whatsoever
use Applicazza\Appointed\Appointment; // ... $appointment_1100_1130 = Appointment::make(today( 11, 00), today(11, 30)); $appointment_1200_1330 = Appointment::make(today( 12, 00), today(13, 30)); $business_day->addAppointments( $appointment_1100_1130, $appointment_1200_1330 );
- To fit previously failed appointment use
BusinessDay::fit(Appointment $appointment, $direction = 'forward')that will return either null or recommended Appointment
$business_day->fit($appointment_1300_1330, 'backward'); $business_day->fit($appointment_1300_1330);
- To delete appointment(s) use
BusinessDay::deleteAppointments(Appointment ...$appointment)that will return boolean
$business_day->deleteAppointments($appointment_1300_1330);
- To delete operating period use
BusinessDay::deleteOperatingPeriod(Period $period)that will return boolean
$business_day->deleteOperatingPeriod($period_0900_1400)
- To edit operating period use
BusinessDay::editOperatingPeriod(Period $old_period, Period $new_period)that will return boolean
$business_day->editOperatingPeriod($period_1330_1400, $period_1330_1430)
- To get whole day agenda use
BusinessDay::getAgenda()that will return array of Period and/or Appointment ordered ascending. Since underlying classes implement JsonSerializable interface this data may be easily encoded to json.
$agenda = $business_day->getAgenda(); // To pretty print results echo json_encode($business_day->getAgenda(), JSON_PRETTY_PRINT), PHP_EOL;
Helpers
use function Applicazza\Appointed\interval; use function Applicazza\Appointed\today; // ... interval($hours = 0, $minutes = 0, $seconds = 0); today($hours = 0, $minutes = 0, $seconds = 0);
applicazza/appointed 适用场景与选型建议
applicazza/appointed 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10.84k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2017 年 07 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 applicazza/appointed 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 applicazza/appointed 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 10.84k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 12
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-07-02