Laravel: Php Artisan Down --Secret!

Reza Khademi
2 min readJan 7, 2023
Laravel: Php Artisan Down — Secret!

All of us know if we want to put our application into maintenance mode, we just need to run:

php artisan down

This Artisan command will display a custom view to everyone who is trying to access our app during downtime. When the application is in maintenance mode, a http exception instance will be thrown with a status code of 503.

Laravel: Php Artisan Down — Secret!

But imagine a scenario that we need to have access to the application and we only want just some qualified users can interact with our app.

For a situation like this, Laravel provides us a --secret flag with php artisan down command as below:

php artisan down --secret="9230542a-256b-8b66-afa2-dd72a4c43544"

That flag will tell our application that anybody with this secret can Bypass Maintenance Mode and we can use it on the application URL as below:
Laravel: Php Artisan Down — Secret!

By accessing this hidden route, we will redirect to the / route of our application. Once the cookie has been saved to our browser, we can browse our app normally just like it was not in maintenance mode.

Keep it in mind that the secret token could be any simple string with optional dashes e.g: demo but always use as secure one!