Usage agnostic JSON delivery in PHP