Skip to content

Instantly share code, notes, and snippets.

@iqbmo04
Forked from sincarne/serve.sh
Created December 20, 2018 12:42
Show Gist options
  • Save iqbmo04/0578f8857e15287c527b7174a09e1e20 to your computer and use it in GitHub Desktop.
Save iqbmo04/0578f8857e15287c527b7174a09e1e20 to your computer and use it in GitHub Desktop.
Shell function to start a server
# Add this to your .profile
# Typing `serve` with no arguments will start the PHP inbuilt
# server, listening on port 8000.
# If you provide an argument, that is assumed to be the port
# on which to listen.
function serve() {
if [ $# -eq 0 ]; then
php -S localhost:8000
else
php -S localhost:"$@"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment