Get "PHP 8 in a Nuthshell" (Now with PHP 8.4)
Amit Merchant

Amit Merchant

A blog on PHP, JavaScript, and more

Accessing Laravel documentation from the terminal

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.

The 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 so.

$ php artisan docs controllers

This will redirect you to the controller’s documentation like so.

Specifying 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

Lastly, 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.

In closing

I think 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.

Learn the fundamentals of PHP 8 (including 8.1, 8.2, 8.3, and 8.4), the latest version of PHP, and how to use it today with my new book PHP 8 in a Nutshell. It's a no-fluff and easy-to-digest guide to the latest features and nitty-gritty details of PHP 8. So, if you're looking for a quick and easy way to PHP 8, this is the book for you.

Like this article?

Buy me a coffee

👋 Hi there! I'm Amit. I write articles about all things web development. You can become a sponsor on my blog to help me continue my writing journey and get your brand in front of thousands of eyes.

Comments?