add observer pattern to php