New Facebook Connect Library For CodeIgniter Released

-CodeIgniter Logo-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.

  Tags:, ,



Recommended Articles


Inside Social Apps 2012 is Less Than Two Weeks Away

Inside Social Apps, held on February 8-9 in San Francisco, is less than two weeks away. This is the third conference on the future of monetization on social and mobile platforms. Leaders from the industry will share their views on today's most formidable challenges affecting social and mobile apps and games in 2012. Inside Social Apps conferences sell out in advance, so take advantage of early registration pricing. Early bird rates end on February 1, so register today.

20 Comments »

  1. 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

  2. yes! Actually what i was waiting for. Is this blog built on CI?

    Comment by Sarabjit 'sarb' Singh — May 29, 2009 @ 12:02 pm

  3. 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

  4. 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

  5. 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

  6. 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

  7. What is Facebook's stance on caching profile pics?

    Comment by Travell Perkins — August 20, 2009 @ 8:48 pm

  8. nice CI liblary……….

    Comment by Facebook User — December 9, 2009 @ 9:25 am

  9. i will try ….

    Comment by ioezhe — December 9, 2009 @ 9:43 am

  10. It rocks :)

    Comment by Radoslav Mazganov — December 21, 2009 @ 4:20 am

  11. This is awesome thanks!

    Comment by Brent van Rensburg — February 22, 2010 @ 4:58 am

  12. awesome thanks!

    Comment by alabandit — March 28, 2010 @ 1:18 am

  13. ddfdfd

    Comment by Ram Ratan Tiwari — April 17, 2010 @ 5:39 am

  14. 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

  15. i'll try

    Comment by Ericka Bourne — June 9, 2010 @ 9:21 pm

  16. This should come in very handy indeed I hope! :)

    Comment by Stephen Riley — July 20, 2010 @ 6:56 am

  17. 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

  18. 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

  19. 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

  20. Very good post

    Comment by Mohammed Salih — July 30, 2011 @ 2:18 am

RSS feed for comments on this post. TrackBack URL

Leave a comment

Send us a Tip

tips@allfacebook.com
[Inside Social Apps 2012]
[AllFacebook Stats: Facebook Analytics for Your Business]
[How can Facebook change your business?]

Upcoming Events

Inside Social Apps

February 8-9, 2012 | San Francisco

Inside Social Apps

Developing & monetizing on social & mobile platforms

Social Gaming Summit

23-24 May, 2012 | Berlin

Social Gaming Summit

Where Gaming Meets the Social Web

AllFacebook Marketing Conference

June 28-29, 2012 | San Francisco

AllFacebook Marketing Conference

Your how-to guide for Facebook marketing.