Switch the script to a symfony/console script.

This gets everything into a more object-oriented approach which should
help simplify things as behavior gets more complex and variable.