Writing your own Helper Functions of Facebook PHP SDK

If you are using PHP in developing your Facebook applications, it is very likely that you have used the PHP SDK.

It is true that the PHP SDK helps us a lot.  Having said that, I found it even more handy after building some more high level helper functions to handle case like:

  • error handling, e.g. to kick of the OAuth 2.0 flow if the exception thrown from the PHP SDK is of type OAuth that relates to expired session, invalid token, missing permission etc.  Otherwise, just perform standard error handling such as log it.
  • obtain detail information about the app requests that user received.
  • checking the permission.
  • resend the api request in case of timeout
  • .
  • .

These helper functions will probably save your some effort when upgrading to a new version of the PHP SDK too.

This entry was posted in Development Tips and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *