Developers

Console Commands

Patrol includes console commands you can run from your Craft project’s directory.

Access Tokens

patrol/access-token/generate

Prints a new random 32-character token for maintenance mode access. Add it to maintenanceModeAccessTokens and send the link to the person who needs access. The command only prints the token, so nothing changes until you add it to your configuration. This is also the default action, so php craft patrol/access-token runs it. Access Tokens explains how the link works.

php craft patrol/access-token/generate

Authorized IPs

These commands manage the IP addresses that visitors authorized with an access token. They don't affect the addresses in maintenanceModeAuthorizedIps. Because the addresses are stored in the database, the commands work on environments where allowAdminChanges is false.

patrol/authorized-ips/list

Lists each IP address authorized through an access token, oldest first. This is also the default action, so php craft patrol/authorized-ips runs it.

php craft patrol/authorized-ips/list

patrol/authorized-ips/remove

Removes a single IP address, so that visitor sees the maintenance page again until they use a valid access token.

php craft patrol/authorized-ips/remove 203.0.113.10

patrol/authorized-ips/clear

Removes every IP address authorized through an access token. Run it after replacing a token that was shared too widely, or once maintenance is over. Patrol asks for confirmation first, unless you pass --interactive=0.

php craft patrol/authorized-ips/clear
Last updated: Nov 26, 2026, 11:57:31 AM