Added php API.
Fixed profile to work with new PHP API