julioserpone/sla-manager
Composer 安装命令:
composer require julioserpone/sla-manager
包简介
A PHP package for calculating & tracking the Service Level Agreement completion timings
README 文档
README
A PHP package to calculate and track Service Level Agreement completion times.
Inspired from the sla-timer pack.
Features
- 🕚 Easy schedule building
- ‼️ Defined breaches
- 🏝 Holiday & Paused Durations
Installation
You can install the sla-manager via composer:
composer require julioserpone/sla-manager
Getting Started
The best place to get started with SLA timer is to head over to the ✨ SLA Timer Getting Started Documentation.
Example Usage
To create a new SLA Timer, we can start by defining our SLA Schedule:
require 'vendor/autoload.php'; use JulioSerpone\SlaManager\SLA; use JulioSerpone\SlaManager\SLABreach; use JulioSerpone\SlaManager\SLASchedule; /** * Create a new SLA between 9am and 5:30pm weekdays */ $sla = SLA::fromSchedule( SLASchedule::create()->from('09:00:00')->to('17:30:00') ->onWeekdays() );
We can define out breaches by calling the addBreaches method on our SLA
/** * Define two breaches, one at 24 hours, and the next at 100 hours */ $sla->addBreaches([ new SLABreach('First Response', '24h'), new SLABreach('Resolution', '100h'), ]);
Now that our SLA Schedule and SLA Breaches are defined, all we have to do is give our subject "creation time" – or our SLA start time – to either the status method, or the duration method.
// Given the time now is 14:00:00 29-07-2022 $status = $sla->status('05:35:40 25-07-2022'); // SLAStatus $status->breaches; // [SLABreach] [0: { First Response } ] $duration = $sla->duration('05:35:40 25-07-2022'); // CarbonInterval $duration->forHumans(); // 1 day 15 hours
Testing
composer test
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.
julioserpone/sla-manager 适用场景与选型建议
julioserpone/sla-manager 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 107 次下载、GitHub Stars 达 1, 最近一次更新时间为 2022 年 10 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「julioserpone」 「sla-manager」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 julioserpone/sla-manager 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 julioserpone/sla-manager 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 107
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-10-07