Laravel Kernel.php file alternative
Asked Answered
B

2

5

Im trying to work with ai on my project in Laravel. Most of them are a bit outdated, so if I want some scheduling they suggest using kernel.php in app/Console.

I did some research and kernel.php file is now hidden somewhere in new Laravel versions. Whats the alternative of using kernel?

Brigette answered 25/5, 2024 at 12:24 Comment(0)
W
8

In laravel 11, kernel.php is no longer present and the related configuration should be handled through the bootstrap/app.php file.

Task scheduling is done in routes/console.php file in laravel 11.

For more detailed information about bootstrap/app.php file you can check this link.

https://laravel-news.com/laravel-11-directory-structure#content-the-app-directory

Also check the release note of the laravel 11 here..

https://laravel.com/docs/11.x/releases

https://laravel.com/docs/11.x/releases#scheduling

I hope it will help you.

Walcott answered 25/5, 2024 at 12:40 Comment(2)
Thank you. For anyone else with this issue, here is the specific section in the release notes mentioned above laravel.com/docs/11.x/releases#schedulingFellers
@Thor, Thank you for your comment, I have updated the answer annexing the exact link that you provided here.Walcott
C
1

Task scheduling can also be done in /bootstrap/app.php using withSchedule:

use Illuminate\Console\Scheduling\Schedule;

->withSchedule(function (Schedule $schedule) {
    $schedule->command('some:signature')->daily();
})
Cowled answered 28/10, 2024 at 21:11 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.