PHPackages                             machatschek/laravel-server-timing - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. machatschek/laravel-server-timing

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

machatschek/laravel-server-timing
=================================

Add Server-Timing header information from within your Laravel apps.

3.1.0(4y ago)644.0k1[1 PRs](https://github.com/mmachatschek/laravel-server-timing/pulls)MITPHPPHP ^8.0

Since Feb 3Pushed 3y ago1 watchersCompare

[ Source](https://github.com/mmachatschek/laravel-server-timing)[ Packagist](https://packagist.org/packages/machatschek/laravel-server-timing)[ Docs](https://github.com/machatschek/laravel-server-timing)[ RSS](/packages/machatschek-laravel-server-timing/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (9)Versions (11)Used By (0)

Laravel Server Timings
======================

[](#laravel-server-timings)

[![Latest Version on Packagist](https://camo.githubusercontent.com/13c8a7db13dc17863dd25853ec0a26de817f7fb6563d0323088cc42e285bf51f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6163686174736368656b2f6c61726176656c2d7365727665722d74696d696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/machatschek/laravel-server-timing)[![Build Status](https://github.com/mmachatschek/laravel-server-timing/workflows/tests/badge.svg)](https://github.com/mmachatschek/laravel-server-timing/actions)[![Total Downloads](https://camo.githubusercontent.com/86298be378eb08656d3199ec836dd79e77f3f19abedbf0fea0dac6b0be28fb0f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6163686174736368656b2f6c61726176656c2d7365727665722d74696d696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/machatschek/laravel-server-timing)

Add Server-Timing header information from within your Laravel apps.

> ⚠️ **Fork of beyondcode/laravel-server-timing**

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require machatschek/laravel-server-timing
```

Usage
-----

[](#usage)

To add server-timing header information, you need to add the `\BeyondCode\ServerTiming\Middleware\ServerTimingMiddleware::class,` middleware to your HTTP Kernel. In order to get the most accurate results, put the middleware as the first one to load in the middleware stack.

By default, the middleware measures only three things, to keep it as light-weight as possible:

- Bootstrap (time before the middleware gets called)
- Application time (time to get a response within the app)
- Total (total time before sending out the response)

Once the package is successfully installed, you can see your timing information in the developer tools of your browser. Here's an example from Chrome:

[![image](https://user-images.githubusercontent.com/40676515/73973252-d831a980-48e7-11ea-88fc-a606fd5b758a.png)](https://user-images.githubusercontent.com/40676515/73973252-d831a980-48e7-11ea-88fc-a606fd5b758a.png)

Adding additional measurements
------------------------------

[](#adding-additional-measurements)

If you want to provide additional measurements, you can use the start and stop methods. If you do not explicitly stop a measured event, the event will automatically be stopped once the middleware receives your response. This can be useful if you want to measure the time your Blade views take to compile.

```
ServerTiming::start('Running expensive task');

// do something

ServerTiming::stop('Running expensive task');
```

If you already know the exact time that you want to set as the measured time, you can use the `setDuration` method. The duration should be set as milliseconds:

```
ServerTiming::setDuration('Running expensive task', 1200);
```

In addition to providing milliseconds as the duration, you can also pass a callable that will be measured instead:

```
ServerTiming::setDuration('Running expensive task', function() {
    sleep(5);
});
```

Adding textual information
--------------------------

[](#adding-textual-information)

You can also use the Server-Timing middleware to only set textual information without providing a duration.

```
ServerTiming::addMessage('User: '.$user->id);
```

Disabling
---------

[](#disabling)

To disable, add `SERVER_TIMING=false` to your `.env` file.

Publishing configuration file
-----------------------------

[](#publishing-configuration-file)

The configuration file could be published using: `php artisan vendor:publish --tag=server-timing-config`

You can disable the middleware changing the `timing.enabled` configuration to false.

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Marcel Pociot](https://github.com/mpociot)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 52.1% 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 ~84 days

Recently: every ~9 days

Total

10

Last Release

1532d ago

Major Versions

1.3.0 → 2.0.02021-06-17

2.0.0 → 3.0.02022-01-24

PHP version history (5 changes)1.0.0PHP ^7.3

1.1.0PHP ^7.2

1.3.0PHP ^7.2|^8.0

2.0.0PHP ^7.3|^8.0

3.0.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/07c4c8c990b06e629567c3e5e93e3520f002a2b0909b42a06eef3d0e546a3a5c?d=identicon)[machatschek](/maintainers/machatschek)

---

Top Contributors

[![mmachatschek](https://avatars.githubusercontent.com/u/10237069?v=4)](https://github.com/mmachatschek "mmachatschek (25 commits)")[![mpociot](https://avatars.githubusercontent.com/u/804684?v=4)](https://github.com/mpociot "mpociot (10 commits)")[![binaryk](https://avatars.githubusercontent.com/u/6833714?v=4)](https://github.com/binaryk "binaryk (6 commits)")[![adamhopkinson](https://avatars.githubusercontent.com/u/1493635?v=4)](https://github.com/adamhopkinson "adamhopkinson (2 commits)")[![intellow](https://avatars.githubusercontent.com/u/40676515?v=4)](https://github.com/intellow "intellow (1 commits)")[![drbyte](https://avatars.githubusercontent.com/u/404472?v=4)](https://github.com/drbyte "drbyte (1 commits)")[![sarfraznawaz2005](https://avatars.githubusercontent.com/u/201788?v=4)](https://github.com/sarfraznawaz2005 "sarfraznawaz2005 (1 commits)")[![spekulatius](https://avatars.githubusercontent.com/u/8433587?v=4)](https://github.com/spekulatius "spekulatius (1 commits)")[![sschlein](https://avatars.githubusercontent.com/u/2911113?v=4)](https://github.com/sschlein "sschlein (1 commits)")

---

Tags

beyondcodelaravel-server-timing

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/machatschek-laravel-server-timing/health.svg)

```
[![Health](https://phpackages.com/badges/machatschek-laravel-server-timing/health.svg)](https://phpackages.com/packages/machatschek-laravel-server-timing)
```

###  Alternatives

[beyondcode/laravel-server-timing

Add Server-Timing header information from within your Laravel apps.

5712.0M1](/packages/beyondcode-laravel-server-timing)[spatie/laravel-health

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[yadahan/laravel-authentication-log

Laravel Authentication Log provides authentication logger and notification for Laravel.

416632.8k5](/packages/yadahan-laravel-authentication-log)[kitloong/laravel-app-logger

Laravel log for your application

101.2M8](/packages/kitloong-laravel-app-logger)[label84/laravel-auth-log

Log user authentication actions in Laravel.

3654.0k](/packages/label84-laravel-auth-log)[shaffe/laravel-mail-log-channel

A package to support logging via email in Laravel

1286.2k](/packages/shaffe-laravel-mail-log-channel)

PHPackages © 2026

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