facebook development with zend framework

36
Facebook Development using Zend Framework QuickTime™ and a None decompressor are needed to see this Brett Harris

Upload: brett-harris

Post on 17-May-2015

33.125 views

Category:

Technology


1 download

DESCRIPTION

ZendCon 2008 presentation on Facebook Development using Zend Framework

TRANSCRIPT

  • 1. Facebook Development using Zend Framework Brett Harris

2. Make it work. Make it right. Make it fast. Make it fast. Make it fast. 3. Challenges

  • Development Environments & Deployment
  • Differences from Normal web
  • Learning Curve

4. Development Environment& Deployment & Deployment

  • Publicly accessible development environments
  • FBML Parser Proxy
  • Configuration makes life easy

5. 3-Tier Architecture 6. 5-Tier Architecture 7. Development Environment

  • Webserver must be publicly accessible
  • Must register FB application to use API
  • Facebook must parse FBML to see UI

8. Proxy Pattern http://en.wikipedia.org/wiki/Proxy_pattern 9. Dev Environment Proxy 10. FBML Parser ...

... 11. FBML Parser Parsed by Facebook Not parsed Brett Harris is presenting at ZendCon 12. FBML Parser Proxy functionsmarty_function_fb_name( $params , & $smarty ) { if(Framework_Config::get( 'MODE')=='local' ) { return 'Grant Raphael' ; } $fbml ='$value ) { $fbml .=$key.'="'. addslashes( $value ) .'"' ; } $fbml .=' />' ; return $fbml ; } http://smarty.net/manual/en/plugins.php 13. FBML Parsing Mock ... {fb_profile_pic uid="12345" size="thumb" } {fb_name uid="12345" }

{fb_user_status uid="12345" linked="false" }

... 14. FBML Parsing Mock Grant Raphael is updating their status Parsed by Facebook Not parsed Brett Harris is speaking at ZendCon 15. Configuration

  • Ease deployment
  • Manage mocks

[environments] dev_foo_com= DEV www_foo_com= LIVE [DEV] APP_NAME= sample_application BASE_DIR= /var/www/html/sample ETC_DIR= /var/www/html/sample/FBFramework/application/etc MODEL_DIR= /var/www/html/sample/FBFramework/application/model CONTROLLER_DIR= /var/www/html/sample/FBFramework/application/controller VIEW_DIR= /var/www/html/sample/FBFramework/application/public/view COMPILE_DIR= /tmp/templates_c SESSION_DIR= /tmp/sessions FRAMEWORK_DIR= /var/www/html/sample/FBFramework/Framework UI_DIR= /var/www/html/sample/FBFramework/Framework/UI DEFAULT_CONTROLLER= index DEFAULT_ACTION= index VIEW_EXTENSION= tpl BASE_URL=http://dev.foo.com/sample EXTERNAL_URL=http://dev.foo.com/sample MODE= local [facebook] FB_USER_ID= 1 FB_FRIENDS= 1,2,3,4,5 API_KEY= XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX SECRET_KEY= XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX SESSION_KEY= XXXXXXXXXXXXXXXXXXXXXXXX-XXXXXXXXX 16. Differences from Normal Web

  • POST
  • Header redirects

17. POST

  • Cant post files due to 5-tiers
  • File makes it to FB, but is not passed along

18. POST

  • Post to your server, then redirect

< html > ... < formmethod = "post"action = "{$EXTERNAL_URL}/item/save" >... form > ... html >

[environments] dev_foo_com= DEV [DEV] ... BASE_URL=http://apps.facebook.com/sample EXTERNAL_URL=http://dev.foo.com/sample 19. Header Redirects

  • Cant redirect due to 5-tier

20. Header Redirects

  • Use _forwarding

21. Learning Curve

  • FQL
  • FBML
  • etc

22. FQL

  • Consider it SQL
  • Accessed via web service
  • Requires valid FB session

23. ActiveRecord http://en.wikipedia.org/wiki/Active_record_pattern 24. Easier to learn 25. Dont build CRUD

  • for FQL or for SQL