Search by

helgesverre / vapor-swap

HelgeSverre

Manage Laravel Vapor profiles and switch accounts per terminal or permanently.

Package info

github.com/HelgeSverre/vapor-swap

Type:project

pkg:composer/helgesverre/vapor-swap

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-10-21 21:22 UTC

This package is auto-updated.

Last update: 2026-11-04 04:13:33 UTC


README

Vapor Swap — a developer riding a glowing broom through a neon nebula, switching between cloud accounts

Vapor Swap

Tests PHP 8.2+ Shells: Bash, Zsh, Fish License: MIT

Save your Laravel Vapor accounts and switch between them. Each saved profile contains an API token and a team.

Requires PHP 8.2+, Composer, and the Vapor CLI. Terminal switching works with Zsh, Bash, and Fish on macOS/Linux.

Install

composer global require helgesverre/vapor-swap

If vapor-swap is not found, add the directory printed by composer global config bin-dir --absolute to your PATH.

Shell setup

Add this to ~/.zshrc:

eval "$(vapor-swap init zsh)"

Then run source ~/.zshrc or open a new terminal.

For Bash, add eval "$(vapor-swap init bash)" to ~/.bashrc. For Fish, add vapor-swap init fish | source to ~/.config/fish/config.fish.

Usage

vapor-swap add work                  # Prompts for a token and team
vapor-swap add personal --token APITOKENHERE --team 50346
vapor-swap list                      # Show saved profiles
vapor-swap swap work                 # Switch this terminal
vapor deploy production             # Use Vapor as usual
vapor-swap swap personal --sticky    # Set the default for future terminals
vapor-swap current                   # Show the current account and team
vapor-swap reset                     # Return to the saved default
vapor-swap remove work               # Remove a profile

swap leaves other terminals alone. --sticky updates ~/.laravel-vapor/config.json and clears this terminal's temporary selection. Existing terminals with their own selection keep it.

Use vapor after switching; calling vendor/bin/vapor directly bypasses the terminal selection.

A token with one team selects it automatically. With multiple teams, you choose from a list. Adding a profile does not switch to it. Use add work --replace to update an existing profile.

For scripts, use --token-stdin and --team. list and current support --json. Run vapor-swap <command> --help for all options.

Zsh completions

mkdir -p ~/.zsh/completions
vapor-swap completion zsh > ~/.zsh/completions/_vapor-swap

Add these lines to ~/.zshrc, before any existing compinit call:

fpath=("$HOME/.zsh/completions" $fpath)
autoload -Uz compinit && compinit

If your Zsh setup already calls compinit, keep that call and only add the fpath line before it. Open a new terminal to enable completions.

Stored credentials

Profiles are saved in ~/.vapor-swap/config.json. Tokens are stored as plaintext with private file permissions, like Vapor's own config. Temporary selections are saved in ~/.vapor-swap/sessions/; old files can be deleted once the shells using them have closed.

Removing a profile does not revoke its token or clear existing authentication.

Development

composer install
composer test
composer lint

Tests use disposable home directories and fake credentials. CI tests PHP 8.2–8.5, macOS, Windows, and the real Vapor CLI. PHP 8.1 and 8.6 run as compatibility probes.