PHPackages                             mc0de/console-timer - 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. mc0de/console-timer

ActiveLibrary

mc0de/console-timer
===================

A trait for tracking execution time in Laravel console commands

1.0.3(1y ago)14369↓100%MITPHPPHP ^8.1

Since Apr 25Pushed 1y ago1 watchersCompare

[ Source](https://github.com/mc0de/console-timer)[ Packagist](https://packagist.org/packages/mc0de/console-timer)[ RSS](/packages/mc0de-console-timer/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (4)Used By (0)

Laravel Console Timer
=====================

[](#laravel-console-timer)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d0698695d65bda3949c370b23fb59edd19be91be1493f1fec76896c02a7106d1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d633064652f636f6e736f6c652d74696d65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mc0de/console-timer)[![Total Downloads](https://camo.githubusercontent.com/9884e0e834e0d6fe08ecb4539f8cc9b36890ed138b89f96ff1825feafa8cff53/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d633064652f636f6e736f6c652d74696d65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mc0de/console-timer)[![License](https://camo.githubusercontent.com/72c30d7efceb296a51b529749cfd5ae22ae7c933e0bdead029c9cbd13d8e9445/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d633064652f636f6e736f6c652d74696d65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mc0de/console-timer)

A simple trait that adds execution time tracking to your Laravel console commands. Useful for:

- Tracking how long your commands take to run
- Measuring specific operations within commands
- Debugging slow operations
- Getting timing feedback during long-running processes

[![Console Timer](https://private-user-images.githubusercontent.com/8727992/438390898-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hNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDMyNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjAzMjVUMDQ0MDQwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NWE1NDNkMTFlNGM2ZDU2MTM1YTI2ZmUxMjQ4ZTZmNjc0ZWNiNjM0OWI4YTY1ZjRiNDE2NWJmNWFmMzQ2MjdlZCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.GJcq83AUVjNFHJp7MnHoc1Cr56Sb4aXVfqj03AsFSw8)

Features
--------

[](#features)

- Track total command execution time
- Measure individual operations
- Get operation return values
- Format durations in a readable way
- Start/stop measurements manually or with closures

Requirements
------------

[](#requirements)

- PHP ^8.1
- Laravel 10.x|11.x|12.x

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

[](#installation)

```
composer require mc0de/console-timer
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

Add the trait to your command and wrap operations you want to measure:

```
use Mc0de\ConsoleTimer\ConsoleTimer;
use Illuminate\Console\Command;

class YourCommand extends Command
{
    use ConsoleTimer;

    public function handle()
    {
        $this->startCommandTimer();

        $this->measure('Processing items', function () {
            // Your processing logic
        });

        $this->displayCommandTime();
    }
}
```

### Getting Return Values

[](#getting-return-values)

```
$result = $this->measure('Fetching data', function () {
    return ['data' => 'value'];
});

// $result contains ['data' => 'value']
```

### Manual Timing

[](#manual-timing)

For operations that span multiple methods:

```
public function handle()
{
    $this->startCommandTimer();

    $this->startMeasure('Processing items');
    $this->processItems();
    $this->finishMeasure();

    $this->displayCommandTime();
}

protected function processItems()
{
    // This method is part of the measured operation
}
```

Example Output
--------------

[](#example-output)

```
  19:17:45 Fetching CRM data ........................................ 1.92s ✓
  19:17:47 Syncing product catalog .................................. 2.34s ✓
  19:17:49 Processing user data ..................................... 394ms ✓
  19:17:49 Running ML recommendations ............................... 3.76s ✓
  19:17:53 Generating sales report .................................. 899ms ✓
  19:17:54 Creating analytics dashboard ............................. 5.26s ✓
  19:17:59 Saving to database ....................................... 389ms ✓

  Completed in 14.99s

```

Methods
-------

[](#methods)

- `startCommandTimer()` - Start tracking total command time
- `measure(string $message, Closure $callback)` - Measure an operation and show progress
- `startMeasure(string $message)` - Start measuring without a closure
- `finishMeasure()` - End the current measurement
- `displayCommandTime()` - Show total command execution time

License
-------

[](#license)

MIT License - see [LICENSE.md](LICENSE.md)

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance51

Moderate activity, may be stable

Popularity22

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

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

Total

3

Last Release

375d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e524a347eed55a510dba1636e0019c9cb45cfe8543bc5fca01ffaea950266701?d=identicon)[mc0de](/maintainers/mc0de)

---

Top Contributors

[![mc0de](https://avatars.githubusercontent.com/u/8727992?v=4)](https://github.com/mc0de "mc0de (6 commits)")

### Embed Badge

![Health badge](/badges/mc0de-console-timer/health.svg)

```
[![Health](https://phpackages.com/badges/mc0de-console-timer/health.svg)](https://phpackages.com/packages/mc0de-console-timer)
```

###  Alternatives

[livewire/livewire

A front-end framework for Laravel.

23.5k75.5M1.8k](/packages/livewire-livewire)[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k84.2M224](/packages/laravel-horizon)[laravel/ui

Laravel UI utilities and presets.

2.7k134.9M596](/packages/laravel-ui)[laravel/sail

Docker files for running a basic Laravel application.

1.9k186.9M1.0k](/packages/laravel-sail)[laravel/jetstream

Tailwind scaffolding for the Laravel framework.

4.1k19.8M136](/packages/laravel-jetstream)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M255](/packages/laravel-dusk)

PHPackages © 2026

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