Skip to content

[12.x] Explicitly bind Console Kernel in bootstrap/app.php for … #6633

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

raphael123514
Copy link

…proper Artisan command and schedule handling

Issue

With the new fluent configuration API introduced in Laravel 12 for bootstrap/app.php, the Console Kernel is not automatically registered in the service container. This causes scheduled commands and Artisan commands to fail silently or report messages like:

No scheduled commands are ready to run.

and prevents proper execution of Artisan commands.


Solution

This pull request explicitly binds the Illuminate\Contracts\Console\Kernel interface to the App\Console\Kernel implementation inside bootstrap/app.php. This ensures that the framework can correctly resolve the Console Kernel when handling scheduled tasks and Artisan commands.


Changes made

Added the following binding in bootstrap/app.php:

use Illuminate\Contracts\Console\Kernel as ConsoleKernelContract;
use App\Console\Kernel as AppConsoleKernel;

$app->singleton(ConsoleKernelContract::class, function ($app) {
    return $app->make(AppConsoleKernel::class);
});

…proper Artisan command and schedule handling

### Issue

With the new fluent configuration API introduced in Laravel 12 for `bootstrap/app.php`, the Console Kernel is not automatically registered in the service container. This causes scheduled commands and Artisan commands to fail silently or report messages like:

> No scheduled commands are ready to run.

and prevents proper execution of Artisan commands.

---

### Solution

This pull request explicitly binds the `Illuminate\Contracts\Console\Kernel` interface to the `App\Console\Kernel` implementation inside `bootstrap/app.php`. This ensures that the framework can correctly resolve the Console Kernel when handling scheduled tasks and Artisan commands.

---

### Changes made

Added the following binding in `bootstrap/app.php`:

```php
use Illuminate\Contracts\Console\Kernel as ConsoleKernelContract;
use App\Console\Kernel as AppConsoleKernel;

$app->singleton(ConsoleKernelContract::class, function ($app) {
    return $app->make(AppConsoleKernel::class);
});
@GrahamCampbell GrahamCampbell changed the title [8.x / 12.x] Explicitly bind Console Kernel in bootstrap/app.php for … [12.x] Explicitly bind Console Kernel in bootstrap/app.php for … Jun 21, 2025
@AhmedAlaa4611
Copy link
Contributor

I think it should be made in the core for two reasons:

  • This file is all about the configuration that the user may need to change.
  • This is against the slim skeleton we have made in Laravel 12!!

@taylorotwell
Copy link
Member

I am closing this pull request because it lacks sufficient explanation, tests, or both. It is difficult for us to merge pull requests without these things because the change may introduce breaking changes to the framework.

Feel free to re-submit your change with a thorough explanation of the feature and tests - integration tests are preferred over unit tests. Please include it's benefit to end users; the reasons it does not break any existing features; how it makes building web applications easier, etc.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants