icebear / drush-uli-qr
Adds a --qr option to Drush's user:login (uli) that prints the one-time login link as an ANSI QR code, scannable with a phone camera straight off the terminal.
Requires
- php: ^8.2
- chillerlan/php-qrcode: ^6.0
- drush/drush: ^12 || ^13
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Adds a --qr option to Drush's user:login (uli) command that prints the
one-time login link as an ANSI QR code — scan it with a phone camera straight
off the terminal.
drush uli --qr --uid=123 --uri=https://example.ngrok.app
[notice] A one-time login link:
█▀▀▀▀▀█ ▀▄█▀▄▀▀▄ █▀▀▀▀▀█
█ ███ █ ▀▄▀█▄▀▄▀ █ ███ █ (scannable QR code,
█ ▀▀▀ █ █▄▀ ▄▀▀█ █ ▀▀▀ █ ~45 columns wide)
▀▀▀▀▀▀▀ ▀ ▀ ▀ ▀ ▀▀▀▀▀▀▀
https://example.ngrok.app/user/reset/123/…/login
Why
Getting a one-time login link onto a physical phone is annoying: messaging it to yourself often burns the link because messenger link previews (iMessage and friends) fetch it once — and uli links are single-use. Scanning a QR code off your terminal sidesteps that entirely.
Install
composer require --dev icebear/drush-uli-qr
That's it — Drush ≥ 12 auto-discovers the command hook via the package's
PSR-4 Drush\Commands\… namespace. No module to enable, nothing to configure.
Because it lives in require-dev, production --no-dev installs skip it
entirely and uli behaves exactly as stock.
Usage
drush uli --qr [--uid=… | --name=… | --mail=…] --uri=<base URL>
Everything user:login already does is unchanged; --qr only adds the QR
code above the printed link.
--uri is important
The QR code is only useful if the phone can open the encoded link. Without
--uri, the link is minted on your site's default local host (e.g.
myproject.ddev.site, which publicly resolves to 127.0.0.1) — unreachable
from a phone. The command warns when the minted host is localhost-only
(localhost, 127.0.0.1, *.localhost, *.ddev.site, *.lndo.site).
Pass a base URL the phone can reach, e.g.:
- a tunnel URL —
ddev share/ ngrok / Cloudflare Tunnel; - a LAN address or reverse-proxy origin, e.g.
--uri=http://192.168.1.50:8899.
Requirements
- PHP ≥ 8.2
- Drush 12 or 13
- chillerlan/php-qrcode ^6.0 (installed automatically)
License
MIT