Skip to content

Instantly share code, notes, and snippets.

@srph
Last active March 6, 2016 23:23
Show Gist options
  • Save srph/c6d7bf0b9c6c04354dad to your computer and use it in GitHub Desktop.
Save srph/c6d7bf0b9c6c04354dad to your computer and use it in GitHub Desktop.
Shorthand bash script for PHP SAPI (Built-in Web Server)
#!/bin/bash
# Usage: sapi [port]
# Examples: sapi 5k, 5000
PORT=$1
if [ "$PORT" == "" ]; then
PORT=8080
elif [ "${PORT:$((${#PORT} - 1)), -1}" == "k" ]; then
PORT="${PORT%?}000"
fi
php -S localhost:$PORT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment