Web Niraj
  • Facebook
  • Flickr
  • Github
  • Linkedin
  • Twitter
  • YouTube
Online portfolio, code examples and developer blog
  • About
  • Contact
  • Portfolio
  • WordPress
Search the site...
  • Home
  • Blog
  • Facebook API: Setting up the Facebook PHP SDK 4.0.x

Facebook API: Setting up the Facebook PHP SDK 4.0.x

3

One of the most common questions I get regarding Facebook’s new PHP SDK v4.0.x is how to set it up and get started. My previous tutorial covers how to start using the SDK, but not how to arrange your files and the SDK itself – this tutorial attempts to bridge the gap.

After downloading the latest version of the Facebook PHP SDK (currently v4.0.7), you need to extract the source code and copy them into your application folder. The best way to do this is to copy the contents of the src folder into your application folder. The src folder contains a single Facebook folder with all the PHP files you need to use the SDK. You only need to copy the Facebook folder from here.

A typical application setup can be as follows:

If you use a PHP Framework like CodeIgnitor, you should copy the Facebook folder to the /application/libraries folder instead. For example:

Once the basic file structure is set up, you can follow the “Getting Started” tutorial to find out how to start building Facebook Apps.

Facebook, Facebook Graph API, Facebook PHP SDK 4.0, PHP

3 comments on “Facebook API: Setting up the Facebook PHP SDK 4.0.x”

  1. Facebook API: Graph API v2.1 Now Available, ‘Likegates’ No Longer Allowed | Web Niraj says:
    August 12, 2014 at 1:38 PM

    […] significant changes to how some of the API calls work while deprecating other features. The current Facebook PHP SDK stable version is still v4.0.9 and uses Graph API v2.0, but PHP SDK v4.1 will eventually make use of Graph API v2.1. Facebook has […]

    Reply
  2. Nate says:
    August 12, 2014 at 11:59 PM

    This was a huge help — thanks!

    Reply
  3. JEP says:
    January 7, 2015 at 8:47 AM

    THANK YOU!! these set of postings were incredibly helpful. After some reading, I was able to learn, and implement what I needed. MMMUCH appreciate your postings and help!!

    Reply

Leave a ReplyCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

StackExchange / StackOverflow

profile for Niraj Shah on Stack Exchange, a network of free, community-driven Q&A sites

Support Me

Buy Me a Coffee

PSN Profile

Tags

ACL Amazon Amazon Web Services Android Android 4.4 KitKat Android 5.0 Lollipop Apache Backup Bug Command Line Cordova cPanel / WHM Facebook Facebook Graph API Facebook PHP SDK 4.0 Facebook Social Plugins Fan Page Firewall Flash Gadget Geolocation Google Nexus 5 Hacking HTML5 iOS JavaScript jQuery Laravel 5 Linux NodeJS Parse PDF PHP Plugin Portfolio PS4 Review Security Server SSH SSL Sysadmin Tutorial WordPress WordPress Plugins
© 2011-2025 Niraj Shah
  • Blog
  • Portfolio
  • WordPress
  • About Me
  • Contact Me
  • Privacy Policy
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Privacy Policy