Skip to content

Instantly share code, notes, and snippets.

@steven-prybylynskyi
Created August 22, 2017 10:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steven-prybylynskyi/7a8089d9af117551fbb9e07a6768d4b1 to your computer and use it in GitHub Desktop.
Save steven-prybylynskyi/7a8089d9af117551fbb9e07a6768d4b1 to your computer and use it in GitHub Desktop.
Symfony router:match helper
# Symfony router:match
rtm() {
url=$1
# remove domain
url=`echo $url | sed -r 's#.*//[^/]+##g'`
# add leading slash
firstChar="${url:0:1}"
[ ! $firstChar == "/" ] && url=/$url
match=$(script -q -c "core/symfony/app/backend/console router:match $url")
if [[ $match = *'None of the routes match'* ]]
then
console router:match $url/
else
echo "$match"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment