/readme.md

http://github.com/facebook/php-sdk · Markdown · 85 lines · 57 code · 28 blank · 0 comment · 0 complexity · 11360463fe7ac7f3d61e4656c3587ec1 MD5 · raw file

  1. We have created a new repository for this project: https://github.com/facebook/facebook-php-sdk. Please update anything you have pointing at this repostory to this location before April 1, 2012.
  2. Facebook PHP SDK (v.3.1.1)
  3. ==========================
  4. The [Facebook Platform](http://developers.facebook.com/) is
  5. a set of APIs that make your app more social
  6. This repository contains the open source PHP SDK that allows you to access Facebook Platform from your PHP app. Except as otherwise noted, the Facebook PHP SDK
  7. is licensed under the Apache Licence, Version 2.0
  8. (http://www.apache.org/licenses/LICENSE-2.0.html)
  9. Usage
  10. -----
  11. The [examples][examples] are a good place to start. The minimal you'll need to
  12. have is:
  13. require 'facebook-php-sdk/src/facebook.php';
  14. $facebook = new Facebook(array(
  15. 'appId' => 'YOUR_APP_ID',
  16. 'secret' => 'YOUR_APP_SECRET',
  17. ));
  18. // Get User ID
  19. $user = $facebook->getUser();
  20. To make [API][API] calls:
  21. if ($user) {
  22. try {
  23. // Proceed knowing you have a logged in user who's authenticated.
  24. $user_profile = $facebook->api('/me');
  25. } catch (FacebookApiException $e) {
  26. error_log($e);
  27. $user = null;
  28. }
  29. }
  30. Login or logout url will be needed depending on current user state.
  31. if ($user) {
  32. $logoutUrl = $facebook->getLogoutUrl();
  33. } else {
  34. $loginUrl = $facebook->getLoginUrl();
  35. }
  36. [examples]: http://github.com/facebook/facebook-php-sdk/blob/master/examples/example.php
  37. [API]: http://developers.facebook.com/docs/api
  38. Tests
  39. -----
  40. In order to keep us nimble and allow us to bring you new functionality, without
  41. compromising on stability, we have ensured full test coverage of the SDK.
  42. We are including this in the open source repository to assure you of our
  43. commitment to quality, but also with the hopes that you will contribute back to
  44. help keep it stable. The easiest way to do so is to file bugs and include a
  45. test case.
  46. The tests can be executed by using this command from the base directory:
  47. phpunit --stderr --bootstrap tests/bootstrap.php tests/tests.php
  48. Contributing
  49. ===========
  50. For us to accept contributions you will have to first have signed the [Contributor License Agreement](https://developers.facebook.com/opensource/cla).
  51. When commiting, keep all lines to less than 80 characters, and try to follow the existing style.
  52. Before creating a pull request, squash your commits into a single commit.
  53. Add the comments where needed, and provide ample explanation in the commit message.
  54. Report Issues/Bugs
  55. ===============
  56. [Bugs](https://developers.facebook.com/bugs)
  57. [Questions](http://facebook.stackoverflow.com)