Laravel | Artisan Console Introduction
Teams applying “Laravel | Artisan Console Introduction” in a production project can use the full explanation to record implementation, review and debugging time, then compare that effort with tests and shipped functionality instead of treating activity as performance by itself.
Before copying the example into a live application, confirm version-specific behaviour with the official Laravel website and test it against the project’s actual database and runtime.
Hello Dev,
This artical is laravel has its own Command Line interface called Artisan.
Its like a Linux command line but the commands are helpful for building a Laravel application.
With this command-line tool, we can make models, controllers, and can do data migrations and many more. First, we will have to change the directory in your command line console (i.e. cmd on windows or terminal on Linux/Mac) or any other CLI software, to the directory of your Laravel app.
All artisan commands: Then by writing ‘php artisan list’ in the console, we will be able to see all the artisan commands that can be used. We can also write ‘php artisan’ and press enter, to display all the available commands in the artisan console. With this command, we will be able to see a long list of commands that the php artisan supports.
Let's start following command.
Command:
php artisan list
or
php artisan
Output:
To get help : If we want to know more about any command then we can write:
Command :
php artisan help
or
php artisan help make:model
Output:
Version check: If we want to know the version of our Laravel app then we can write ‘-V‘ option.
Command:
php artisan -V
Output:
Make commands: If these are not enough, then we can make our own command by using make:command. Know more of it by using the help command as described above in To get help section.
Command:
php artisan make:controller
Console Environment: There is one console environment that the Artisan provides and that is tinker.
The Tinker gives you an environment with the help of which the user can interact with the Laravel application and gives a simple way to access the data in the database.
Command:
php artisan tinker
Output:
- How to Notifications With database Driver in Laravel 11?
- How to Send Email Via Notification in Laravel 11?
- How to Install and Configure Laravel 11 Debugbar?
- How to Like Dislike System in Laravel 11?
- How to Paginate a Model with Relationship in Laravel 11?
- Laravel 11 Upload Files to Amazon S3 Example
- Laravel 11 Send WhatsApp Messages Example
- Laravel 11 Rest API Authentication Using JWT Tutorial