Integration between Zend Framework and Facebook Connect - php

I'm developing a web app with zend framework and i'd like to discuss what is the best way to intergrate all the JS and FBML in a ZF project, anyone have some experience.
For example, which may be a good solution for have the Facebook istante in every controllers, a front controller plugin?

For all those still landing on this POST: There is a Facebook PHP SDK on github, offered by facebook now.
It is quite helpfull and has a good documentation and examples.
The other Projects listed above are mostly stopped or in alpha status.

Since JS and FBML is part of the presentation layer, these would have to go into ViewHelpers. Fetching data from FB via their APIs would go into a service, like Zend_Service_Facebook. There is a proposal for both components in Ready for Review state for some time now:
http://framework.zend.com/wiki/display/ZFPROP/Zend_Service_Facebook+-+Ian+Warner
http://code.google.com/p/zend-service-facebook/

There's a Zend Framework Library that you can use to access all Facebook Methods at GitHub from your controllers and Models.
https://github.com/erickthered/Facebook-PHP-SDK-for-Zend-Framework
For the views, it's better to add the facebook JS file with the APPID and XFBML parameters to your layout/template so that you can use tags anywhere.

If you are using zend framework 2 you can use this tutorial...
http://kdecom.blogspot.co.nz/2012/10/how-to-login-using-facebook-in-zend.html

Related

Opensource framework to create gmail/google group/facebook kind of interface (and some functionalities)

I am starting a new opensource project. This will be a web app with modern layout/functionalities. I want this app to work like gmail/facebook/google group.. or some other google products. I want to load all the js/css and other assets only one time and load part of pages using ajax request.
I want to use PHP (maybe cakePHP, jQuery). I know how to create this kind of app from scratch, but i am looking for some kind of opensource framework which will help me to not create everything from scratch.
Any help would be appreciated.
There is a php framework called Elgg (http://www.elgg.org/) which is a php framework designed for social networking based applications.

PHP Zend, Facebook Share Option

I want to create a facebook share option after payment is succeeded. I am trying to develop a simple website that is coded in PHP with Zend Framework. Can you advice me something or give me reference that i can look to. Thank you in advance.
The default share functionality is considered deprecated by facebook itself. You can read about this here: Facebook Developers - Share
The suggested method is to implement the current version of the Like-button of which you can read about more on this page: Facebook Developers - Like
You'll find lots of information on the page itself. To get started, you should read yourself into Facebook Developers - PHP SDK Overview
PS: Pretty unreliant to Zend Framework itself :)

How to create an API-centric application (more specifically: for HMVC in CodeIgniter)

Background:
I am working on a web application, that I plan to launch with iPhone and Android versions in the near future, and I have some questions about developing an API for use by the different front-ends.
I Started with This:
I was reading this TutsPlus tutorial, which talks about creating an API-centric web application, meaning that all of your browser calls and smartphone app calls are routed through the API.
What especially got me excited, was this statement in the tutorial from Twitter:
One of the most important architectural changes is that Twitter.com is now a client of our own API. It fetches data from the same endpoints that the mobile site, our apps for iPhone, iPad, Android, and every third-party application use.
The above statement reflects, what I would ideally like to create.
Then I Saw This:
I found this TutsPlus tutorial, which talks about, how to build a REST API for CodeIgniter. This was good, because I am developing my application in CodeIgniter, using the Modular Extensions plugin - HMVC, and I thought it would be perfect for my purposes.
The only thing, that I'm somewhat lost in, is the way Phil Sturgeon seems to suggest to create the API. He suggests to have all of your front-end code modules completed and then create an API for each of the modules in their respective directories (not necessarily in that order). This would be fine if I didn't want it to be API-centric.
And I Want to Know How to Do This:
How should I proceed to get a blend of both tutorials:
API-centric application that can be used by a browser application as well as separate mobile applications
REST API for CodeIgniter (with HMVC modules)
Should I:
Just follow the API-centric tutorial and try to tailor it to my needs?
Follow the CodeIgniter-specific tutorial and use Phil Sturgeon's advice for how to implement it with HVMC?
A combination of both?
Neither?
Take a look at Eating your own Dogfood by Nick Jackson. These are slides from CICONF 2012 where he details how this all works.
Building your API first is a great idea, then your application can use the API to fetch the data itself. This is of course a little slower as you're adding a HTTP request on data, but locally its not too bad and if you use HMVC to make the request it's even quicker.
In the tutorial I didn't get into HMVC because it's an extra subject, but it can be awesome for adding modular API's. In some simple applications I just make a /api folder like the tutorial suggested but PyroCMS Professional has an API module and a sexy route to allow modular API stuff:
$route['api/([a-zA-Z0-9_-]+)/(:any)'] = '$1/api/$2';
$route['api/([a-zA-Z0-9_-]+)'] = '$1/api/index';
This means I can have a "api.php" controller in every module and still use the /api/controller/method syntax or even /api/controller if you have function index_get().
I would strongly suggest you grab PyroCMS Professional for this feature. Yep you gotta pay, but it handles user key generation, authorisation, logging, etc all out of the box and handles your website too.

Is it a good idea to use CakePHP for Facebook App development project

I want to develop, facebook app, iframe app running on Facebook.com.
Is it a good idea to use CakePHP frame work for this? My app will also have Paypal integration.
I am still learning CakePHP.
Thanks,
Hardik
I recently developed a Facebook app with CakePHP and it works great. If you're developing an iframe app, then the limitations of the backend technologies are the same limitations that you'd experience outside of the Facebook environment. If you're concerned about the benefits/drawbacks of CakePHP as a PHP framework, then I'd check out this question: https://stackoverflow.com/questions/249984/php-framework-decision-analysis-paralysis.
If you are new to CakePHP, then you'll obviously find some difficulty, since there is a learning curve, but as far as using it within Facebook, you'll find that most of the issues will be surrounding the frontend, and this has nothing to do with CakePHP.
I've recently made a few Facebook Applications in CakePHP and they work just fine. Stick your whole Facebook Session handling in the AppController's beforeFilter() method so every other controller has your Facebook Session and it's pretty easy from there.

How can I access a REST data source from a PHP framework?

We are looking to build a PHP web application to manage data that is available only through a 3rd party REST like interface.
We would like to use an existing PHP framework to do this, we're considering cakephp and codeigniter, but are open to other options.
We expect the biggest problem will be creating models that utilise the REST API as a data source instead of a local database.
I've written a base ReST datasource plugin for CakePHP and am using it in lots of other plugins that interact with ReSTful APIs. Plugins I've released so far are YahooGeoPlanet and bit.ly and I'm also currently working on ones for Google Apis (YouTube and Analytics), Twitter, Twitpic and Facebook. They use the CakePHP's excellent HttpSocket class that deceze mentions.
Have a look at those CakePHP plugins and you should be able to see how simple but powerful they are.
You might look at Zend_Rest_Client, which I've never used, but appears worth a look.
Failing that, Zend_Http_Client is pretty solid for abstracting away all the curl ugliness.
Either one can be used independently of the rest of the Zend Framework stuff, and should interoperate just fine with other frameworks.
You can implement it as a Datasource in Cake, which to the Model and therefore to the rest of the application behaves exactly as a database would. Internally the Datasource can dynamically fetch the data using cURL or the Cake HttpSocket. Have a look at the Twitter API example.

Categories