Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Console Kernel in Laravel PHP?

I am reading the documentation at Laravel under the heading Architecture Concepts.

I am unable to understand application and usage of Console Kernel .(not the Http Kernel) However, I googled out and found these links

https://laravel.com/api/5.2/Illuminate/Foundation/Console/Kernel.html https://laravel.com/api/5.3/Illuminate/Contracts/Console/Kernel.html

But I can't understand anything with that API !

like image 513
Tilak Maddy Avatar asked May 03 '17 13:05

Tilak Maddy


People also ask

What is Console kernel in Laravel?

devquora. Posted On: Jun 08, 2021. The HTTP Kernel is used to process requests that come in through the web (HTTP) whereas the Console Kernel is used when you interact with your application from the command line.

Where is kernel php in Laravel?

The console kernel is defined in the app/Console/Kernel. php (this will be referred to as the application console kernel) file. The kernel class that exists in that file extends Laravel's console kernel (which can be found in the vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.

What is console php Laravel?

Using console route, you can create your own artisan commands. It is registered inside app/Console/kernal.php file. Let's say you want to alter column in your table, you can register in console route and run queries.

What is the use of Tinker in Laravel?

Laravel Tinker allows you to interact with a database without creating the routes. Laravel tinker is used with a php artisan to create the objects or modify the data. The php artisan is a command-line interface that is available with a Laravel. Tinker is a command tool that works with a php artisan.


1 Answers

The HTTP Kernel is used to process requests that come in through the web (HTTP). Website requests, AJAX, that kind of stuff.

The Console Kernel is used when you interact with your application from the command line. If you use artisan, or when a scheduled job is processed, or when a queued job is processed, all of these actions go through the Console Kernel.

Basically, if you go through index.php, you'll be using the HTTP Kernel. Most everything else will be using the Console Kernel.

like image 170
patricus Avatar answered Oct 14 '22 16:10

patricus