{"id":19357761,"url":"https://github.com/joomla-framework/facebook-api","last_synced_at":"2025-04-23T11:30:35.532Z","repository":{"id":8433917,"uuid":"10023234","full_name":"joomla-framework/facebook-api","owner":"joomla-framework","description":"[DEPRECATED] Joomla Framework Facebook Package","archived":false,"fork":false,"pushed_at":"2021-09-18T10:33:03.000Z","size":238,"stargazers_count":6,"open_issues_count":0,"forks_count":12,"subscribers_count":16,"default_branch":"2.0-dev","last_synced_at":"2025-04-02T14:21:48.204Z","etag":null,"topics":["facebook","joomla","joomla-framework","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joomla-framework.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"joomla","custom":"https://community.joomla.org/sponsorship-campaigns.html"}},"created_at":"2013-05-13T02:44:56.000Z","updated_at":"2024-09-24T09:21:25.000Z","dependencies_parsed_at":"2022-09-14T08:51:17.851Z","dependency_job_id":null,"html_url":"https://github.com/joomla-framework/facebook-api","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joomla-framework%2Ffacebook-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joomla-framework%2Ffacebook-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joomla-framework%2Ffacebook-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joomla-framework%2Ffacebook-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joomla-framework","download_url":"https://codeload.github.com/joomla-framework/facebook-api/tar.gz/refs/heads/2.0-dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250424939,"owners_count":21428470,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["facebook","joomla","joomla-framework","php"],"created_at":"2024-11-10T07:09:05.667Z","updated_at":"2025-04-23T11:30:35.218Z","avatar_url":"https://github.com/joomla-framework.png","language":"PHP","funding_links":["https://github.com/sponsors/joomla","https://community.joomla.org/sponsorship-campaigns.html"],"categories":[],"sub_categories":[],"readme":"## The Facebook Package [![Build Status](https://ci.joomla.org/api/badges/joomla-framework/facebook-api/status.svg)](https://ci.joomla.org/joomla-framework/facebook-api)\r\n\r\n### Deprecated\r\n\r\nThe `joomla/facebook` package is deprecated with no further updates planned.\r\n\r\n### Using the Facebook Package\r\n\r\nThe Facebook package is designed to be a straightforward interface for working with Facebook. It is based on the Graph API. You can find documentation on the API at [http://developers.facebook.com/docs/reference/api/](http://developers.facebook.com/docs/reference/api/).\r\n\r\n#### Instantiating Facebook\r\n\r\nInstantiating Facebook is easy:\r\n\r\n```php\r\nuse Joomla\\Facebook\\Facebook;\r\n\r\n$facebook = new Facebook;\r\n```\r\n\r\nThis creates a basic Facebook object that can be used to access publicly available resources on facebook.com which don't require an active access token.\r\n\r\nSometimes it is necessary to provide an active access token with the required permissions. This can be done by instantiating OAuth.\r\n\r\nCreate a Facebook application at [https://developers.facebook.com/apps](https://developers.facebook.com/apps) in order to request permissions. Instantiate OAuth, passing the Registry options needed. The API key, API secret and callback URL (which is the script's path) from the Facebook application are passed through the Registry object. By default you have to send headers manually in your application, but if you want this to be done automatically you can set Registry's option 'sendheaders' to true.\r\n\r\n```php\r\nuse Joomla\\Facebook\\Facebook;\r\nuse Joomla\\Facebook\\OAuth;\r\n\r\n$options = array(\r\n    'clientid' =\u003e $app_id,\r\n    'clientsecret' =\u003e $app_secret,\r\n    'redirecturi' =\u003e $callback_url,\r\n    'sendheaders' =\u003e true,\r\n    'authmethod' =\u003e 'get'\r\n);\r\n\r\n$oauth = new OAuth($options);\r\n\r\n$facebook = new Facebook($oauth);\r\n```\r\nNow you can authenticate and request the user to authorise your application in order to get an access token, but if you already have an access token stored you can set it to the OAuth object and if it's still valid your application will use it.\r\n\r\n```php\r\n// Set the stored access token.\r\n$oauth-\u003esetToken($token);\r\n\r\n$access_token = $oauth-\u003eauthenticate();\r\n```\r\n\r\nWhen calling the authenticate() method, your stored access token will be used only if it's valid, a new one will be created if you don't have an access token or if the stored one is not valid. The method will return a valid access token that's going to be used.\r\n\r\nSet scope to the OAuth object. Scope is a comma separated list of requested permissions:\r\n\r\n```php\r\n$oauth-\u003esetScope('read_stream,publish_stream');\r\n```\r\n\r\n#### Accessing the Facebook API's objects\r\n\r\nThe Facebook package has 12 objects of the Graph API currently implemented:\r\n* Album\r\n* Checkin\r\n* Comment\r\n* Event\r\n* Group\r\n* Link\r\n* Note\r\n* Photo\r\n* Post\r\n* Status\r\n* User\r\n* Video\r\n\r\nOnce a Facebook object has been created, it is simple to use it to access Facebook:\r\n\r\n```php\r\n$user = $facebook-\u003euser-\u003egetFeed($user_id);\r\n```\r\n\r\nThis will retrieve an array of Post objects containing (up to) the last 25 posts.\r\n\r\n#### A More Complete Example\r\n\r\nBelow is an example demonstrating more of the Facebook package.\r\n\r\n```php\r\nuse Joomla\\Facebook\\Facebook;\r\nuse Joomla\\Facebook\\OAuth;\r\n\r\n$app_id = \"app_id\";\r\n$app_secret = \"app_secret\";\r\n$my_url = 'http://localhost/facebook_test.php';\r\n\r\n$options = array(\r\n    'clientid' =\u003e $app_id,\r\n    'clientsecret' =\u003e $app_secret,\r\n    'redirecturi' =\u003e $callback_url,\r\n    'sendheaders' =\u003e true,\r\n    'authmethod' =\u003e 'get'\r\n);\r\n\r\n$oauth = new OAuth($options);\r\n$oauth-\u003eauthenticate();\r\n\r\n$facebook = new Facebook($oauth);\r\n\r\n$user = $facebook-\u003euser;\r\n$response = $user-\u003egetFeed(\"me\");\r\n```\r\n\r\n#### More Information\r\n\r\nThe following resources contain more information\r\n* [Joomla! API Reference](http://api.joomla.org)\r\n* [Facebook Graph API Reference](http://developers.facebook.com/docs/reference/api/)\r\n\r\n\r\n## Installation via Composer\r\n\r\nAdd `\"joomla/facebook\": \"2.0.*@dev\"` to the require block in your composer.json and then run `composer install`.\r\n\r\n```json\r\n{\r\n\t\"require\": {\r\n\t\t\"joomla/facebook\": \"2.0.*@dev\"\r\n\t}\r\n}\r\n```\r\n\r\nAlternatively, you can simply run the following from the command line:\r\n\r\n```sh\r\ncomposer require joomla/facebook \"2.0.*@dev\"\r\n```\r\n\r\nIf you want to include the test sources, use\r\n\r\n```sh\r\ncomposer require --prefer-source joomla/facebook \"~1.0\"\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoomla-framework%2Ffacebook-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoomla-framework%2Ffacebook-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoomla-framework%2Ffacebook-api/lists"}