A PHP package for calculating & tracking the Service Level Agreement completion timings

Overview

Logo for SLA Timer

Latest Version on Packagist Total Downloads GitHub Actions

A PHP package for calculating & tracking the Service Level Agreement completion timings.

Features

  • πŸ•š Easy schedule building
  • ‼️ Defined breaches
  • 🏝 Holiday & Paused Durations

Hi, I'm Alex & I'm currently looking for a Laravel job. Please reach out to me via twitter, or click this link.

Installation

You can install the sla-timer via composer:

composer require sifex/sla-timer

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 Sifex\SlaTimer\SLA;
use Sifex\SlaTimer\SLABreach;
use Sifex\SlaTimer\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.

You might also like...
Rubix ML - A high-level machine learning and deep learning library for the PHP language.

A high-level machine learning and deep learning library for the PHP language. Developer-friendly API is delightful to use 40+ supervised and

Helps detect the user's browser and platform at the PHP level via the user agent

cbschuld/browser.php Helps detect the user's browser and platform at the PHP level via the user agent Installation You can add this library as a local

Couleur is a modern PHP 8.1+ color library, intended to be compatible with CSS Color Module Level 4.

🎨 Couleur: A modern PHP 8.1+ color library 🎨 Couleur: A modern PHP 8.1+ color library πŸ‘‹ Presentation βš™οΈ Installation 🏁 Quick Start πŸ“š Usage 🏭 Imm

Moodle plugin to limit the access to course content according to the user level in Block Game.

Moodle plugin to limit the access to course content according to the user level in Block Game.

A plugin that creates a level system linked to chatting for PocketMine-MP!

ChatLevel A plugin that creates a level system linked to chatting for PocketMine-MP! Issues You can report bugs by simply clicking me! Support You can

Fully covered with tests, documented by Swagger and dockerized API based on enterprise-level framework with optional queue worker.
Fully covered with tests, documented by Swagger and dockerized API based on enterprise-level framework with optional queue worker.

symfony-api Fully covered with tests, documented by Swagger and dockerized API based on enterprise-level framework with optional queue worker. βš™οΈ Depl

Some Joomla! 4.x Web Services Api Examples and Experiments to raise the level of awareness of the huge potiental of Joomla! 4.x Web Services.

j4x-api-examples WHY? If you are a Joomla! developer or want to become a Joomla! developer there is a new resource for you The Official New Joomla! Ma

A beautiful, fully open-source, tunneling service - written in pure PHP
A beautiful, fully open-source, tunneling service - written in pure PHP

Expose A completely open-source ngrok alternative - written in pure PHP. Documentation For installation instructions, in-depth usage and deployment de

Ξ» Run PHP Coroutines & Fibers as-a-Service on the AWS Lambda.
Ξ» Run PHP Coroutines & Fibers as-a-Service on the AWS Lambda.

Ξ» Swoole Runtime for AWS Lambda Run PHP Coroutines & Fibers as-a-Service on the AWS Lambda. Getting started Create your Lambda function index.php ?ph

Comments
  • Feature: Pausing without end time should place the SLA into perpetual hold

    Feature: Pausing without end time should place the SLA into perpetual hold

    The following should put timer into perpetual pause, but also should be optimized enough to break the counter loop (Ie. there won't be any more seconds to count in a perpetual pause)

    /** @var SLA $sla */
    $sla->addPause('2022-07-21 09:00:00');
    

    Maybe even create some nice syntax sugar...

    /** @var SLA $sla */
    $sla->pauseFrom('2022-07-21 09:00:00');
    
    enhancement 
    opened by sifex 0
Releases(v0.1.6.5)
Javascript-powered auto-completion functionality for your Symfony forms!

Symfony UX Autocomplete Javascript-powered auto-completion functionality for your Symfony forms! EXPERIMENTAL This component is currently experimental

Symfony 12 Dec 15, 2022
PHP package that provides functions for calculating mathematical statistics of numeric data

Statistics PHP package PHP package that provides functions for calculating mathematical statistics of numeric data. In this package I'm collecting som

Hi Folks! 289 Dec 27, 2022
PHP package that provides functions for calculating mathematical statistics of numeric data.

Statistics PHP package PHP package that provides functions for calculating mathematical statistics of numeric data. In this package I'm collecting som

Hi Folks! 290 Dec 29, 2022
Tars is a high-performance RPC framework based on name service and Tars protocol, also integrated administration platform, and implemented hosting-service via flexible schedule.

TARS - A Linux Foundation Project TARS Foundation Official Website TARS Project Official Website WeChat Group: TARS01 WeChat Offical Account: TarsClou

THE TARS FOUNDATION PROJECTS 9.6k Jan 1, 2023
Eventum Issue Tracking System

Eventum is a user friendly and very flexible issue tracking system, that can be used by a support department to track incoming technical support requests, or by a software development team to quickly organize tasks and bugs.

Eventum Issue tracking system 152 Dec 14, 2022
Adds a header to every response to try and twart Google's usage of your site in it's FLoC tracking method.

Laravel No FLoC This package will add the Permissions-Policy: interest-cohort=() to try and twart Google's usage of your site in it's FLoC tracking me

Jean-Philippe Murray 11 Jul 14, 2022
Issue tracking application extending GitHub's issues and pull requests for the Joomla! project.

Requirements The issue tracker application requires a server running: PHP 7.2 or 7.3 PHP's ext/curl and ext/intl should also be installed MySQL 5.5.3

Joomla! 68 Oct 27, 2022
A high-level machine learning and deep learning library for the PHP language.

Rubix ML A high-level machine learning and deep learning library for the PHP language. Developer-friendly API is delightful to use 40+ supervised and

Rubix 1.7k Jan 1, 2023
Zephir is a compiled high level language aimed to the creation of C-extensions for PHP.

Zephir - is a high level programming language that eases the creation and maintainability of extensions for PHP. Zephir extensions are exported to C c

Zephir Language 3.2k Jan 2, 2023
Allows generate class files parse from json and map json to php object, including multi-level and complex objects;

nixihz/php-object Allows generate class files parse from json and map json to php object, including multi-level and complex objects; Installation You

zhixin 2 Sep 9, 2022