PHPackages                             codeldev/laravel-schedule-log - 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. codeldev/laravel-schedule-log

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

codeldev/laravel-schedule-log
=============================

A simple Laravel package that automatically logs every scheduled command execution to your database. It listens to Laravel's built-in schedulerevents to record information without wrapping or modifying the scheduler itself. Ships with configurable table names, swappable Eloquent models, and a built-in prune command to manage retention.

1.0.0(1mo ago)014↓100%[1 PRs](https://github.com/codeldev/laravel-schedule-log/pulls)MITPHPPHP ^8.4CI passing

Since Apr 13Pushed 1mo agoCompare

[ Source](https://github.com/codeldev/laravel-schedule-log)[ Packagist](https://packagist.org/packages/codeldev/laravel-schedule-log)[ Docs](https://github.com/codeldev/laravel-schedule-log)[ GitHub Sponsors](https://github.com/codeldev)[ RSS](/packages/codeldev-laravel-schedule-log/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (18)Versions (3)Used By (0)

Laravel Schedule Log
====================

[](#laravel-schedule-log)

[![Latest Version on Packagist](https://camo.githubusercontent.com/5f03154479dd384162f6967c9ab1938baecb9cf0ae35c212fdec2e62499df669/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f64656c6465762f6c61726176656c2d7363686564756c652d6c6f672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/codeldev/laravel-schedule-log)[![GitHub Tests Action Status](https://camo.githubusercontent.com/a11a0c8a6cf54fc3c21df8760502b7beebb3cbc03cd9057cedc2cc2837c33dcf/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f636f64656c6465762f6c61726176656c2d7363686564756c652d6c6f672f72756e2d74657374732e796d6c3f6272616e63683d6d6173746572266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/codeldev/laravel-schedule-log/actions?query=workflow%3Arun-tests+branch%3Amaster)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/bab7b33d62a7ea9e742246ef7c5ece9540a2553ed9cccd396e439462760f332a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f636f64656c6465762f6c61726176656c2d7363686564756c652d6c6f672f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d6173746572266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/codeldev/laravel-schedule-log/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/90566bae78e073e28fd2091b23b2812398b37234a04c36007382eb386a1353d3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f64656c6465762f6c61726176656c2d7363686564756c652d6c6f672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/codeldev/laravel-schedule-log)

A simple Laravel package that automatically logs every scheduled command execution to your database. It listens to Laravel's built-in scheduler events to record information without wrapping or modifying the scheduler itself. Ships with configurable table names, swappable Eloquent models, and a built-in prune command to manage retention.

**Pest Tests:** 100% Code Coverage | **PHP Stan**: Level Max

---

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

[](#requirements)

- PHP 8.4+
- Laravel 13+

---

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

[](#installation)

You can install the package via composer:

```
composer require codeldev/laravel-schedule-log
```

You can publish and run the migrations with:

```
php artisan vendor:publish --tag="schedule-log-migrations"
php artisan migrate
```

You can publish the config file with:

```
php artisan vendor:publish --tag="schedule-log-config"
```

This is the contents of the published config file:

```
return [
    'prune_days' => (int) env('SCHEDULE_LOG_PRUNE_DAYS', 365),
    'models' => [
        'commands' => CodelDev\LaravelScheduleLog\Models\LaravelScheduledCommand::class,
        'history'  => CodelDev\LaravelScheduleLog\Models\LaravelScheduledCommandHistory::class,
    ],
    'tables' => [
        // Stores the scheduled commands
        'commands' => env('SCHEDULE_LOG_TABLE_COMMANDS', 'scheduled_commands'),
        'history'  => env('SCHEDULE_LOG_TABLE_HISTORY', 'scheduled_commands_history'),
    ],
];
```

### Environment Variables

[](#environment-variables)

The following env variables are available to configure the package using your env file.

```
SCHEDULE_LOG_PRUNE_DAYS=365
SCHEDULE_LOG_TABLE_COMMANDS=scheduled_commands
SCHEDULE_LOG_TABLE_HISTORY=scheduled_commands_history
```

---

⚠️ Required!
------------

[](#️-required)

> In order for the output to be stored for each command, you must add the `storeOutput()` method to your schedule command.

```
Schedule::command('custom:command')
    ->storeOutput()
    ->weeklyOn(1, '02:30')
    ->withoutOverlapping();
```

---

Usage
-----

[](#usage)

Add to your `routes/console.php` file:

```
Schedule::command('schedule-log:prune')
    ->weeklyOn(1, '02:30')
    ->withoutOverlapping();
```

Run manually:

```
php artisan schedule-log:prune
```

---

Querying the Data
-----------------

[](#querying-the-data)

The package provides two Eloquent models you can use directly:

```
use CodelDev\LaravelScheduleLog\Models\LaravelScheduledCommand;
use CodelDev\LaravelScheduleLog\Models\LaravelScheduledCommandHistory;

// Get all logged commands
$commands = LaravelScheduledCommand::all();

// Get history for a specific command
$history = LaravelScheduledCommand::query()
    ->where('command', 'inspire')
    ->with('history')
    ->first()
    ->history;

// Get all failed runs
$failed = LaravelScheduledCommandHistory::query()
    ->where('status', LaravelScheduledRunStatusEnum::FAILED)
    ->latest('started_at')
    ->get();

// Get the last run for a command
$lastRun = LaravelScheduledCommandHistory::query()
    ->whereHas('scheduledCommand', fn ($q) => $q->where('command', 'inspire'))
    ->latest('started_at')
    ->first();
```

---

### Available Fields

[](#available-fields)

**LaravelScheduledCommand**

FieldType`id``string` (UUID)`command``string``description``string|null``created_at``CarbonImmutable``updated_at``CarbonImmutable`**LaravelScheduledCommandHistory**

FieldType`id``string` (UUID)`scheduled_command_id``string` (UUID)`started_at``CarbonImmutable``completed_at``CarbonImmutable|null``status``LaravelScheduledRunStatusEnum``output``string|null``error``string|null``duration_ms``int|null``created_at``CarbonImmutable``updated_at``CarbonImmutable`---

Using Custom Models
-------------------

[](#using-custom-models)

You can extend the package models to add your own behaviour, scopes, or relationships. Create your custom model, extend the package model, then update the config:

```
use CodelDev\LaravelScheduleLog\Models\LaravelScheduledCommandHistory as BaseHistory;

class ScheduledCommandHistory extends BaseHistory
{
    public function scopeFailed($query)
    {
        return $query->where('status', LaravelScheduledRunStatusEnum::FAILED);
    }
}
```

Then in `config/schedule-log.php`:

```
'models' => [
    'commands' => \App\Models\ScheduledCommand::class,
    'history'  => \App\Models\ScheduledCommandHistory::class,
],
```

---

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 Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

---

Credits
-------

[](#credits)

- [CodelDev](https://github.com/CodelDev)

---

License
-------

[](#license)

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

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance91

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity52

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

Unknown

Total

1

Last Release

57d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/179911763?v=4)[CodelDev](/maintainers/CodelDev)[@codeldev](https://github.com/codeldev)

---

Top Contributors

[![codeldev](https://avatars.githubusercontent.com/u/179911763?v=4)](https://github.com/codeldev "codeldev (1 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

laravelcodeldevlaravel-schedule-log

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/codeldev-laravel-schedule-log/health.svg)

```
[![Health](https://phpackages.com/badges/codeldev-laravel-schedule-log/health.svg)](https://phpackages.com/packages/codeldev-laravel-schedule-log)
```

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

88011.3M149](/packages/spatie-laravel-health)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.3M41](/packages/spatie-laravel-pdf)[keepsuit/laravel-opentelemetry

OpenTelemetry integration for laravel

162476.0k](/packages/keepsuit-laravel-opentelemetry)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3913.7k](/packages/rawilk-profile-filament-plugin)[spatie/laravel-error-share

Share your Laravel errors to Flare

421.3M5](/packages/spatie-laravel-error-share)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24655.3k](/packages/vormkracht10-laravel-mails)

PHPackages © 2026

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