This set of PHP functions refactors the 1-file example from Facebook into a modular structure.