{"id":19357756,"url":"https://github.com/joomla-framework/twitter-api","last_synced_at":"2025-04-23T11:30:32.951Z","repository":{"id":10115721,"uuid":"12183202","full_name":"joomla-framework/twitter-api","owner":"joomla-framework","description":"[DEPRECATED] Joomla Framework Twitter Package","archived":false,"fork":false,"pushed_at":"2021-09-18T11:55:22.000Z","size":295,"stargazers_count":3,"open_issues_count":0,"forks_count":9,"subscribers_count":17,"default_branch":"2.0-dev","last_synced_at":"2025-04-02T14:21:49.636Z","etag":null,"topics":["joomla","joomla-framework","php","twitter"],"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":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-08-17T18:09:24.000Z","updated_at":"2024-09-24T09:17:26.000Z","dependencies_parsed_at":"2022-09-17T14:30:14.062Z","dependency_job_id":null,"html_url":"https://github.com/joomla-framework/twitter-api","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joomla-framework%2Ftwitter-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joomla-framework%2Ftwitter-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joomla-framework%2Ftwitter-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joomla-framework%2Ftwitter-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joomla-framework","download_url":"https://codeload.github.com/joomla-framework/twitter-api/tar.gz/refs/heads/2.0-dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250424931,"owners_count":21428469,"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":["joomla","joomla-framework","php","twitter"],"created_at":"2024-11-10T07:09:04.996Z","updated_at":"2025-04-23T11:30:32.677Z","avatar_url":"https://github.com/joomla-framework.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## The Twitter Package [![Build Status](https://travis-ci.org/joomla-framework/twitter-api.png?branch=master)](https://travis-ci.org/joomla-framework/twitter-api)\n\n### Deprecated\n\nThe `joomla/twitter` package is deprecated with no further updates planned.\n\n### Using the Twitter Package\n\nThe Twitter package is designed to be a straightforward interface for working with Twitter. It is based on the REST API. You can find documentation on the API at [https://dev.twitter.com/docs/api](https://dev.twitter.com/docs/api).\n\n#### Instantiating Twitter\n\nInstantiating Twitter is easy:\n\n```php\nuse Joomla\\Twitter\\Twitter;\n\n$twitter = new Twitter;\n```\n\nThis creates a basic Twitter object that can be used to access resources on twitter.com, using an active access token.\n\nGenerating an access token can be done by instantiating OAuth.\n\nCreate a Twitter application at [https://dev.twitter.com/apps](https://dev.twitter.com/apps) in order to request permissions. Instantiate OAuth, passing the options needed. By default you have to set and send headers manually in your application, but if you want this to be done automatically you can set option 'sendheaders' to true.\n\n```php\nuse Joomla\\Http\\Http;\nuse Joomla\\Twitter\\Twitter;\nuse Joomla\\Twitter\\OAuth;\n\n$options = array(\n    'consumer_key' =\u003e $consumer_key,\n    'consumer_secret' =\u003e $consumer_secret,\n    'callback' =\u003e $callback_url,\n    'sendheaders' =\u003e true\n);\n\n$client = new Http;\n$application = $this-\u003egetApplication();\n\n$oauth = new OAuth($options, $client, $application-\u003einput, $application);\n\n$twitter = new Twitter($oauth);\n```\n\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.\n\n```php\n// Set the stored access token.\n$oauth-\u003esetToken($token);\n\n$access_token = $oauth-\u003eauthenticate();\n```\n\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.\n\n#### Accessing the Twitter API's objects\n\nThe Twitter package covers almost all Resources of the REST API 1.1:\n* Block object interacts with Block resources.\n* DirectMessages object interacts with Direct Messages resources.\n* Favorites object interacts with Favorites resources.\n* Followers object interacts with the Followers resources.\n* Friends object interacts with Friends resources.\n* Help object interacts with Help resources.\n* Lists object interacts with Lists resources.\n* Media object interacts with multimedia resources.\n* Mute object interacts with resources related to muting users.\n* Places object interacts with Places and Geo resources.\n* Profile object interacts with some resources from Accounts.\n* Search object interacts with Search and Saved Searches resources.\n* Statuses object interacts with Timelines and Tweets resources.\n* Trends object interacts with Trends resources.\n* Users object interacts with Users and Suggested Users resources.\n\nOnce a Twitter object has been created, it is simple to use it to access Twitter:\n\n```php\n$users = $twitter-\u003eusers-\u003egetUser($user);\n```\n\nThis will retrieve extended information of a given user, specified by ID or screen name.\n\n#### A More Complete Example\n\nBelow is an example demonstrating more of the Twitter package.\n\n```php\nuse Joomla\\Http\\Http;\nuse Joomla\\Twitter\\Twitter;\nuse Joomla\\Twitter\\OAuth;\n\n$token = array(\n\t'key' =\u003e \"app_id\",\n\t'secret' =\u003e \"app_secret\",\n);\n$my_url = 'http://localhost/twitter_test.php';\n\n$options = array(\n    'consumer_key' =\u003e $consumer_key,\n    'consumer_secret' =\u003e $consumer_secret,\n    'callback' =\u003e $callback_url,\n    'sendheaders' =\u003e true\n);\n\n$client = new Http;\n$application = $this-\u003egetApplication();\n\n$oauth = new OAuth($options, $client, $application-\u003einput, $application);\n$oauth-\u003esetToken($token);\n$oauth-\u003eauthenticate();\n\n$twitter = new Twitter($oauth);\n\n$statuses = $twitter-\u003estatuses;\n$response = $statuses-\u003etweet(\"The Twitter Package is amazing #joomla\");\n```\n\n#### More Information\n\nThe following resources contain more information:\n* [Joomla! API Reference](http://api.joomla.org)\n* [Twitter REST API Reference](https://dev.twitter.com/docs/api)\n* [Web Application using JTwitter package](https://gist.github.com/3258852)\n\n## Installation via Composer\n\nAdd `\"joomla/twitter\": \"2.0.*@dev\"` to the require block in your composer.json and then run `composer install`.\n\n```json\n{\n\t\"require\": {\n\t\t\"joomla/twitter\": \"2.0.*@dev\"\n\t}\n}\n```\n\nAlternatively, you can simply run the following from the command line:\n\n```sh\ncomposer require joomla/twitter \"2.0.*@dev\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoomla-framework%2Ftwitter-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoomla-framework%2Ftwitter-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoomla-framework%2Ftwitter-api/lists"}