O'Reilly logo

PHPUnit Essentials by Zdenek Machek

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Testing the Facebook API

Facebook is another service that you might need to use. Let's take a look at how to access the Facebook API and what we can do about testing. For PHP, the official PHP SDK is available at https://github.com/facebook/facebook-php-sdk. The easiest installation method is to use Composer; just add the following code to composer.json:

{
    "require": {
    "facebook/php-sdk": "@stable"
    },
    "autoload": {
        "psr-0": {
            "": "src/"
        }
    }
}

To add the Facebook PHP SDK, just run the following command:

php composer.phar update

When you get used to Composer, then there's no going back. To update the library later, composer update does the job.

To call the Facebook web service, you need FACEBOOK_APP_ID and FACEBOOK_APP_SECRET. The process is similar ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required