PHPackages                             jstewmc/floor-execution-time - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. jstewmc/floor-execution-time

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jstewmc/floor-execution-time
============================

Floor a script's execution time

v2.0.0(9y ago)019MITPHPPHP ^7.0

Since Aug 13Pushed 9y ago1 watchersCompare

[ Source](https://github.com/jstewmc/floor-execution-time)[ Packagist](https://packagist.org/packages/jstewmc/floor-execution-time)[ RSS](/packages/jstewmc-floor-execution-time/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

floor-execution-time
====================

[](#floor-execution-time)

Floor a script's execution time.

This library will calculate a script's total execution time from `$_SERVER['REQUEST_TIME_FLOAT']` to *now* in milliseconds.

If the total execution time is *less than* the *floor*, it will sleep for the difference:

```
namespace Jstewmc\FloorExecutionTime;

// instantiate the service with a 500 millisecond floor
$service = new FloorExecutionTime(500);

// ... something that takes 100 milliseconds

$service();  // sleeps for 400 milliseconds
```

If the execution time is *greater than* the *floor*, it will not sleep:

```
namespace Jstewmc\FloorExecutionTime;

// instantiate the service with a 500 millisecond floor
$service = new FloorExecutionTime(500);

// ... something that takes 1,000 milliseconds

$service();  // sleeps for 0 milliseconds
```

Flooring execution time helps defend against *brute-force* and *timing* attacks. Scripts which are likely to be brute-forced should be slow. Scripts which are likely to be timing attacked should have a constant execution time. Some scripts should be both.

Dependencies
------------

[](#dependencies)

This library depends on the `REQUEST_TIME_FLOAT` [server variable](http://php.net/manual/en/reserved.variables.server.php). There is no guarantee that every web server will provide the `REQUEST_TIME_FLOAT` variable, however, most will. If the `REQUEST_TIME_FLOAT` server variable does not exist, this library will throw a `RuntimeException` on construction.

License
-------

[](#license)

[MIT](https://github.com/jstewmc/floor-execution-time/blob/master/LICENSE)

Author
------

[](#author)

[Jack Clayton](mailto:clayjs0@gmail.com)

Version
-------

[](#version)

### 2.0.0, December 27, 2016

[](#200-december-27-2016)

- Rename `Floor` to `FloorExecutionTime`.
- Update `__construct()` to throw exception if `REQUEST_TIME_FLOAT` server variable does not exist.
- Remove `$start` argument of `__invoke()` method. It makes more sense to use `REQUEST_START_TIME`.

### 1.0.0, August 16, 2016

[](#100-august-16-2016)

- Major release
- Update `composer.json`
- Clean up comments

### 0.1.0, August 3, 2016

[](#010-august-3-2016)

- Initial release

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~136 days

Total

2

Last Release

3472d ago

Major Versions

v1.0.0 → v2.0.02016-12-27

### Community

Maintainers

![](https://www.gravatar.com/avatar/50fecae0a7fd2119681bc133e496e7166b01a59f850a3c909e100bd427c6b28b?d=identicon)[Jstewmc](/maintainers/Jstewmc)

---

Top Contributors

[![jstewmc](https://avatars.githubusercontent.com/u/1192893?v=4)](https://github.com/jstewmc "jstewmc (7 commits)")

---

Tags

phptimefloorexecutionjstewmc

### Embed Badge

![Health badge](/badges/jstewmc-floor-execution-time/health.svg)

```
[![Health](https://phpackages.com/badges/jstewmc-floor-execution-time/health.svg)](https://phpackages.com/packages/jstewmc-floor-execution-time)
```

###  Alternatives

[dater/dater

Compact PHP library for working with date/time in different formats &amp; timezones.

14283.6k](/packages/dater-dater)[zjkal/time-helper

一个简单快捷的PHP日期时间助手类库。 a smart PHP datetime helper library.

21030.2k2](/packages/zjkal-time-helper)[kirouane/interval

Library to handel intervals

2877.3k](/packages/kirouane-interval)[maherelgamil/arabicdatetime

Easy and useful tool to generate arabic or hijri date with multi-language support for laravel

414.6k](/packages/maherelgamil-arabicdatetime)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
