Isolate PHP Code and Make PSR-1, 2, 4 compliant

Isolate PHP Code and Make PSR-1, 2, 4 compliant