PHPackages                             sindscream/laravel-smart-scheduler - 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. sindscream/laravel-smart-scheduler

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

sindscream/laravel-smart-scheduler
==================================

Environment-aware scheduled commands for Laravel: declare a different schedule frequency per environment directly on the command.

00PHP

Since Jun 30Pushed todayCompare

[ Source](https://github.com/sindscream/laravel-smart-scheduler)[ Packagist](https://packagist.org/packages/sindscream/laravel-smart-scheduler)[ RSS](/packages/sindscream-laravel-smart-scheduler/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Smart Scheduler
=======================

[](#laravel-smart-scheduler)

Environment-aware scheduled commands for Laravel. Declare a different schedule frequency **per environment** directly on the command, using Laravel's native scheduling API. No reflection, no custom DSL, no kernel wiring.

```
public function scheduleConfig(): array
{
    return [
        'production' => fn (Event $event) => $event->everyFifteenMinutes()->weekdays(),
        'staging'    => fn (Event $event) => $event->hourly(),
        'default'    => fn (Event $event) => $event->daily(),
        // an environment that is omitted (and has no 'default') is not scheduled
    ];
}
```

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

[](#requirements)

- PHP `^8.3`
- Laravel 10 or 11 (`illuminate/console`, `illuminate/support` `^10.0|^11.0`)

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

[](#installation)

```
composer require sindscream/laravel-smart-scheduler
```

The service provider is auto-discovered. Optionally publish the config:

```
php artisan vendor:publish --tag=env-scheduler-config
```

Usage
-----

[](#usage)

Extend `EnvironmentAwareCommand` and implement `scheduleConfig()`. Each entry maps an environment name to a closure that receives Laravel's `Illuminate\Console\Scheduling\Event`, so the full native frequency and constraint API is available.

```
