If you’ve spoken to me about development at any point in the past few months, you’d know I’ve become a big fan of CodeIgniter for quick application development in PHP. Any regular programmer will always look for ways to save time during the development process. If you happen to be developing a Facebook Connect enabled site, then a Facebook Connect library can help save some time. Thankfully Elliot Haughin has done just that for CodeIgniter developers.
Last week Elliot released an extremely useful Facebook Connect CodeIgniter library that will get you up and running in under 5 minutes. I tested out the library this morning and it’s extremely useful. While I’ve implemented the widely used FB_Controller (found here) for Facebook platform applications, I haven’t implemented Connect with CodeIgniter prior to this morning. In 7 quick steps you can have a demo Facebook Connect enabled application up and running.
The core component of the code is the Facebook_connect class which enables you to quickly see if a Facebook user is logged in by calling a few quick lines of code from within one of your controller functions:
$this->load->library('facebook_connect');
$data = array(
'user' => $this->facebook_connect->user,
'user_id' => $this->facebook_connect->user_id
);
If you then want to make any API calls you can simply call the api client functions. For example to get a user’s events you would then make the following call:
$events = $this->facebook_connect->client->events_get($data['user_id']);
One downside of this feature is that it’s not directly integrated into CodeIgniter’s session handling library but a few tweaks could integrate it pretty easily. As I’m in the process of building a few Facebook Connect enabled features on this site, this library will most definitely come in handy. The version released by Elliot is extremely simple and it works. If you are also implementing Facebook Connect within a CodeIgniter application, go check out Ellion Haughin’s library.






![[Inside Social Apps 2012]](http://www.allfacebook.com/wordpress/wp-content/themes/allfacebook2/images/ISA2012_336x100_F_RegisterNow.gif)
![[AllFacebook Stats: Facebook Analytics for Your Business]](http://www.allfacebook.com/wordpress/wp-content/themes/allfacebook2/images/stpro_allfacebookstats.gif)
![[How can Facebook change your business?]](http://www.allfacebook.com/wordpress/wp-content/themes/allfacebook2/images/FMB_A_MAY2011_336x100_F.gif)


Nice.
I think CI lovers always can follow Elliot on Twitter and know about his libraries weeks before their "official" reliese.
Thanks to Elliot and to you Nick for sharing.
Comment by Mushex Antaranian — May 29, 2009 @ 9:49 am
yes! Actually what i was waiting for. Is this blog built on CI?
Comment by Sarabjit 'sarb' Singh — May 29, 2009 @ 12:02 pm
I tried CodeIgniter when it was in its early stages. It was similar to, but far inferior to, CakePHP at the time. That said, I’m curious to see how far CodeIgniter has come — I’ll have to give it another shot!
Comment by Matt Huggins — May 29, 2009 @ 12:05 pm
Hey Sarabjit,
This blog is built on WordPress but I’m in the process of branching out new arms of the site which are built on CodeIgniter.
Best,
Nick
Comment by Nick ONeill — May 29, 2009 @ 12:07 pm
That's great! Thanks for pointing developer informations a lil more sometimes. By the way, I'm still wondering how do you grab Facebook Apps stats…
Comment by Benoit Villiè — June 3, 2009 @ 2:08 am
Awesome, Nick. I've been meaning to take a look at what you got here, downloading now!
Comment by Ingrid Alongi — June 8, 2009 @ 2:36 pm
What is Facebook's stance on caching profile pics?
Comment by Travell Perkins — August 20, 2009 @ 8:48 pm
nice CI liblary……….
Comment by Facebook User — December 9, 2009 @ 9:25 am
i will try ….
Comment by ioezhe — December 9, 2009 @ 9:43 am
It rocks
Comment by Radoslav Mazganov — December 21, 2009 @ 4:20 am
This is awesome thanks!
Comment by Brent van Rensburg — February 22, 2010 @ 4:58 am
awesome thanks!
Comment by alabandit — March 28, 2010 @ 1:18 am
ddfdfd
Comment by Ram Ratan Tiwari — April 17, 2010 @ 5:39 am
Hello everyone. I have developped another Facebook Connect library, maybe more complete, with also a helper for codeigniter.
You can find it here : http://blog.ebuildy.com/2010/05/13/facebook-conne...
A+
Comment by Harvey Robertson — May 15, 2010 @ 12:18 am
i'll try
Comment by Ericka Bourne — June 9, 2010 @ 9:21 pm
This should come in very handy indeed I hope!
Comment by Stephen Riley — July 20, 2010 @ 6:56 am
Hey guys, we've added on the Elliots and created a really solid tutorial/example code: http://hitsend.ca/2010/10/facebook-connect-user-a...
Comment by Brennan — October 8, 2010 @ 2:43 pm
Is there a way to creat an Invite event or post into the user's wall using this library or anyone knows about a way to do that with codeigniter?
Comment by Felipe — December 28, 2010 @ 4:53 pm
Anyone know if its posible with this library to post to the user's wall or creat an FB invite? or another way to do this with CI?
Comment by Felipe — December 28, 2010 @ 5:04 pm
Very good post
Comment by Mohammed Salih — July 30, 2011 @ 2:18 am