Facebook SDK Login for Zend Framework Tutorial part 2

Download the src(github)
View the demo

This is the second part of using the Facebook SDK as a login mechanism. The first covered how to setup each login button and how that interacted with javascript. This post will cover how the auth adapters work with the controller to verify credentials. At this point you should know how to setup a button in the application.ini.

AuthController

The controller is called from a route. The path /oauth maps to the oauthAction and /ajax maps to the ajaxAction. The main difference between these two actions is how they respond. Oauth redirects the page and ajax responds in JSON.

init()

The init() function is run every time the controller loads before any actions. This is a great place to put code that is shared between all actions. Continue reading “Facebook SDK Login for Zend Framework Tutorial part 2”

Facebook SDK inside of Zend Framework Tutorial

Download the src(github)
View the demo

This tutorial should show you how to take a Zend Framework project and easily add the Facebook SDK to it. You will be able easily make calls to either the Javascript or PHP SDK and also use Facebook’s new Graph API. Let’s get started. Don’t worry if you don’t have Zend Framework or don’t want to use it as I will cover how to do this outside of Zend as well.

It doesn’t matter if use Zend or not, you can follow along and use the code in your project as well.

Setup Zend Framework

First thing to do is download the latest version of Zend Framework. It is a free download, but you will have to create an account. If you don’t use Zend Framework (ZF from here on out) you really should. It is very extensible and versatile. I won’t continue to try and sell you on ZF (and most likely you already are using it).

Next thing to do is setup a project (of course if you have a project just use that). I won’t go into how to do this, but there is a great quickstart tutorial on Zend’s site that is a great introduction if you haven’t used ZF before.

You should now have the default ZF page if all is working correctly.

This should be familiar to you.
This should be familiar to you.

Download the Facebook SDK

Continue reading “Facebook SDK inside of Zend Framework Tutorial”