codrasil/punchcard
Composer 安装命令:
composer require codrasil/punchcard
包简介
A PHP Library for interacting with time records, time in, and time out.
README 文档
README
A PHP Library for interacting with time records, time in, and time out.
Requirements
- php:
>=7.1 - nesbot/carbon:
^2.16
Installation
$ composer require codrasil/punchcard
{
"require": {
"codrasil/punchcard": "^1.*"
}
}
Usage
use Codrasil\Punchcard\Punchcard; $punchcard = new Punchcard; $punchcard->setTimeIn('8:00 AM') // parses into 08:00:00 format ->setTimeOut('5 PM'); // uses Carbon\Carbon for parsing strings to \DateTime $punchcard->lunch($deductLunchHours = true); // calculate with lunch hours subtracted echo $punchcard->totalDuration()->toString(); // performs: $timeOut - $timeIn = $duration in 00:00:00 format. // outputs: 08:00:00 echo $punchcard->totalAM(); // outputs: 04:00:00 echo $punchcard->totalPM(); // outputs: 04:00:00 $punchcard->lunch(false); echo $punchcard->totalDuration()->toString(); // outputs: 09:00:00 // Other methods: $punchcard->setTimeIn('8:15 AM'); $punchcard->totalTardy()->toString(); $punchcard->totalTardyAM()->toString(); // this is the same with totalTardy // outputs: 00:15:00 // Assuming afternoon work resumes at 1PM: $punchcard->setTimeIn('1:15 PM'); $punchcard->totalTardyPM()->toString(); // outputs: 00:15:00 // Assuming work ends at 5PM $punchcard->setTimeOut('6:20 PM'); $punchcard->totalOvertime()->toString(); // outputs: 01:20:00 // Assuming work ends at 5PM $punchcard->setTimeOut('4:20 PM'); $punchcard->totalUndertime()->toString(); // outputs: 5:00PM - 4:20PM = 00:40:00 // AM undertime calculate against default_lunch_start $punchcard->totalUndertimeAM()->toString(); $punchcard->totalUndertimePM()->toString(); // this is the same with totalUndertime
Options
You may pass options upon initialization:
$options = [ 'default_time_in' => '09:00:00', // default is 08:00:00 'default_time_out' => '18:00:00', // default is 17:00:00 'default_lunch_start' => '12:00:00', // default 12:00:00 'default_lunch_end' => '13:00:00', // default 13:00:00 ]; $punchcard = new Punchcard($options);
Or via method setParams:
$punchcard->setParams($options);
Documentation
coming soon
License
The Codrasil/Punchcard PHP library is open-source software licensed under the MIT license.
codrasil/punchcard 适用场景与选型建议
codrasil/punchcard 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6 次下载、GitHub Stars 达 2, 最近一次更新时间为 2019 年 04 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「timesheet」 「dtr」 「Time Management」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 codrasil/punchcard 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 codrasil/punchcard 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 codrasil/punchcard 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
IPv4/IPv6 Network calculator for PHP
Alfabank REST API integration
Freelancer Timesheets and Billing Symfony2 Bundle
ERP projects — projects, tasks and timesheets for the Laravel ERP ecosystem
dTR-SSH is a SSHv2 library
Simple timesheets and vacation management for small businesses.
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-04-04