add a version check for the json output and remove some whitespace
don't close PHP files, its bad practice
some PSR updates and readability updates etc.