A new Laravel release just dropped and with that, a brand new feature is ready to embrace us.
Essentially, a new command called
artisan docs has been introduced with the newly released Laravel 9.23.0. Using this command, it’s now pretty convenient to navigate around Laravel’s documentation right from the terminal.
Let’s see what all the things we can do with this command.
artisan docs command
To get started, run the
php artisan docs command (without any arguments) in your project. Upon running, it will show the list of pages from Laravel’s documentation that you can select interactively.
Here’s how it will look like.
You can select one of the pages from the list by going up and down using arrow keys or if you just hit Enter twice after running this command, it will navigate you to the installation page.
Specifying page’s name
We can specify the name of the page to the command like this.
$ php artisan docs controllers
This will redirect you to the controller’s documentation like this.
Specifying the name of the page fuzzily
The command is very smart. So, if you don’t remember the exact name of the page, you can specify part of the name and it will try redirecting you to the desired page.
For instance, even if I run the
php artisan docs voy command, the command would redirect us to the Envoy’s documentation successfully!
Searching the documentation
Finally, you can also search through the documentation using this command.
For this, all you need to do is to provide your search query after
--. So, if I want to search for “signed urls”here’s how I can do it.
$ php artisan docs -- signed urls
Here’s the output for the same.
And this is what the search looks like on Laravel’s documentation.
artisan docs is a nice addition to the portfolio of the Artisan commands and can come in handy when you want to quickly navigate around Laravel’s documentation.
If you want to learn more about this command and its inner workings, read through this PR.