How to generate signature from server side? Client side its risky to put api and secret key

how to generate signature using php.