PHPackages                             djstarcom/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. djstarcom/laravel-server-timing

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

djstarcom/laravel-server-timing
===============================

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

0.0.3(5y ago)1706[3 PRs](https://github.com/DJStarCOM/laravel-server-timing/pulls)MITPHP

Since Feb 10Pushed 5y agoCompare

[ Source](https://github.com/DJStarCOM/laravel-server-timing)[ Packagist](https://packagist.org/packages/djstarcom/laravel-server-timing)[ Docs](https://github.com/djstarcom/laravel-server-timing)[ RSS](/packages/djstarcom-laravel-server-timing/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (4)Versions (7)Used By (0)

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

[](#laravel-server-timings)

[![Latest Version on Packagist](https://camo.githubusercontent.com/27fd00024f4f2d42cd32dfd5024c7bb713257ebfb142b544d07ed3511c4929a9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f646a73746172636f6d2f6c61726176656c2d7365727665722d74696d696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/djstarcom/laravel-server-timing)[![Build Status](https://camo.githubusercontent.com/04612c9ec7e382911bcca2ac205ee10222fb8c65f8f221a77f8789be4a607a4f/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f646a73746172636f6d2f6c61726176656c2d7365727665722d74696d696e672f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/djstarcom/laravel-server-timing)[![Quality Score](https://camo.githubusercontent.com/4f9b565523a9b54f3c7c7bf5247ec8e03a846292d04c309dcf0dc4ef0ff086a6/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f646a73746172636f6d2f6c61726176656c2d7365727665722d74696d696e672e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/djstarcom/laravel-server-timing)[![Total Downloads](https://camo.githubusercontent.com/17fd30f557fa6600e46341a147bb65b48294c2b9466dbd03b3f6ccff0a486e89/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646a73746172636f6d2f6c61726176656c2d7365727665722d74696d696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/djstarcom/laravel-server-timing)

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

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

[](#installation)

You can install the package via composer:

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

Usage
-----

[](#usage)

To add server-timing header information, you need to add the `\DJStarCOM\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 intstalled, 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.

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.

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

### 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)

- [Stanislav Tsepeniuk](https://github.com/djstarcom)
- [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

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~121 days

Total

3

Last Release

2040d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1e612dd8656b2f610a9bc3f6e3656290363217e48e34f6951fbadb5bd770b242?d=identicon)[StarCOM](/maintainers/StarCOM)

---

Top Contributors

[![DJStarCOM](https://avatars.githubusercontent.com/u/1818603?v=4)](https://github.com/DJStarCOM "DJStarCOM (5 commits)")[![mpociot](https://avatars.githubusercontent.com/u/804684?v=4)](https://github.com/mpociot "mpociot (5 commits)")[![intellow](https://avatars.githubusercontent.com/u/40676515?v=4)](https://github.com/intellow "intellow (1 commits)")

---

Tags

laravelheaderServer-Timing

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M686](/packages/barryvdh-laravel-ide-helper)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)[nedwors/navigator

A Laravel package to ease defining navigation menus

433.1k](/packages/nedwors-navigator)[xefi/faker-php-laravel

Faker php integration with laravel

1915.1k](/packages/xefi-faker-php-laravel)[dcblogdev/laravel-junie

Install pre-configured guides for Jetbrains Junie

392.5k](/packages/dcblogdev-laravel-junie)

PHPackages © 2026

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