Chat() class and function definitions v1
PHP Backend function implementation v1 complete.
Added comments