{"id":13729488,"url":"https://github.com/utxo-one/twitter-ultimate-php","last_synced_at":"2025-04-09T20:22:25.499Z","repository":{"id":58535697,"uuid":"532323967","full_name":"utxo-one/twitter-ultimate-php","owner":"utxo-one","description":"A complete PHP Wrapper for the Twitter v2 API","archived":false,"fork":false,"pushed_at":"2022-11-08T14:01:43.000Z","size":1442,"stargazers_count":19,"open_issues_count":2,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T12:02:53.522Z","etag":null,"topics":["composer","composer-library","php","php81","phpunit","twitter","twitter-api","twitter-api-v2"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/utxo-one.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-09-03T17:08:05.000Z","updated_at":"2024-12-30T10:55:34.000Z","dependencies_parsed_at":"2023-01-22T22:01:28.501Z","dependency_job_id":null,"html_url":"https://github.com/utxo-one/twitter-ultimate-php","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utxo-one%2Ftwitter-ultimate-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utxo-one%2Ftwitter-ultimate-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utxo-one%2Ftwitter-ultimate-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utxo-one%2Ftwitter-ultimate-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/utxo-one","download_url":"https://codeload.github.com/utxo-one/twitter-ultimate-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248104719,"owners_count":21048394,"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":["composer","composer-library","php","php81","phpunit","twitter","twitter-api","twitter-api-v2"],"created_at":"2024-08-03T02:01:01.050Z","updated_at":"2025-04-09T20:22:25.479Z","avatar_url":"https://github.com/utxo-one.png","language":"PHP","funding_links":[],"categories":["Libraries"],"sub_categories":["PHP"],"readme":"## Twitter Ultimate PHP\n\nA complete and opinionated API Wrapper implementation for the Twitter v2 API. Full docblocks for all methods and strict\nreturn types make it easy for developers by providing all the method names and parameters to your IDE.\n\n### Prerequisites\n\n - =\u003e PHP 8.1\n - Composer\n - Twitter Developer Account\n\n\n### Installation\n\n  ```sh\n  composer require utxo-one/twitter-ultimate-php\n  ```\n   \n## Usage\n\n### Tweet Client\n\nThe tweet client can be initialized either to get public information, or to perform authenticated actions.\n\n#### Public API Calls\n\nYou only need to provide your `bearerToken` to initialize a tweet client that accesses public information.\n\n```php\nuse UtxoOne\\TwitterUltimatePhp\\Clients\\TweetClient;\n\n$client = new TweetClient(bearerToken: $_ENV['TWITTER_BEARER_TOKEN']);\n\n$tweet = $client-\u003egetTweet('1272846378268347');\n```\n#### Authenticated API Calls\n\nTo make an authenticated API call, you need to provide your `apiToken` , `apiSecret`, `accessToken`, `accessSecret`.\nAccess tokens are generated after the user authenticates your app.\n\n```php\nuse UtxoOne\\TwitterUltimatePhp\\Clients\\TweetClient;\n\n$client = new TweetClient(\n    apiKey: $_ENV['TWITTER_API_KEY'], \n    apiSecret: $_ENV['TWITTER_API_SECRET'], \n    accessToken: $_ENV['TWITTER_ACCESS_TOKEN'], \n    accessSecret: $_ENV['TWITTER_ACCESS_SECRET'],\n);\n\n$tweet = $client-\u003etweet('Hello World!');\n```\n\n#### Available Tweet Client Methods:\n\n - `getTweet()`\n - `getTweets()`\n - `getQuoteTweets()`\n - `getLikingUsers()`\n - `getRetweetedByUsers()`\n - `tweet()`\n - `deleteTweet()`\n - `likeTweet()`\n - `unlikeTweet()`\n - `retweet()`\n - `unrtweet()`\n - `bookmarkTweet()`\n - `unbookmarkTweet()`\n\n#### Get Tweet Details\n\n```php\nuse UtxoOne\\TwitterUltimatePhp\\Clients\\TweetClient;\n\n$client = new TweetClient(bearerToken: $_ENV['TWITTER_BEARER_TOKEN']);\n$tweet = $client-\u003egetTweet('1565628118001455105');\n\n// Available Getter Methods.\n$tweet-\u003egetId();\n$tweet-\u003egetText();\n$tweet-\u003egetCreatedAt();\n$tweet-\u003egetAuthorId();\n$tweet-\u003egetConversationId();\n$tweet-\u003egetInReplyToUserId();\n$tweet-\u003egetLang();\n$tweet-\u003egetSource();\n$tweet-\u003eisWithheld();\n$tweet-\u003egetPublicMetricS();\n$tweet-\u003egetReplySettings();\n$tweet-\u003egetReferencedTweets();\n$tweet-\u003egetEntities();\n$tweet-\u003egetGeo();\n$tweet-\u003egetContextAnnotations();\n$tweet-\u003eisPossiblySensitive();\n$tweet-\u003egetAttachements();\n```\n#### Get Multiple Tweet Details\n\n```php\nuse UtxoOne\\TwitterUltimatePhp\\Clients\\TweetClient;\n\n$client = new TweetClient(bearerToken: $_ENV['TWITTER_BEARER_TOKEN']);\n$tweets = $client-\u003egetTweets(['1565628118001455105', '1565999511536914433'])-\u003eall();\n\nforeach($tweets as $tweet) {\n  $tweet-\u003egetId();\n  // ...\n}\n```\n### User Management Methods\n\n##### Getting a User's Details\n\n```php\n\nuse UtxoOne\\TwitterUltimatePhp\\Clients\\UserClient;\n\n$client = new UserClient(bearerToken: $_ENV['TWITTER_BEARER_TOKEN']);\n\n$user = $client-\u003egetUserByUsername('utxoone');\n$user-\u003egetId();\n$user-\u003egetName();\n$user-\u003egetUsername();\n$user-\u003egetCreatedAt();\n$user-\u003egetDescription();\n$user-\u003egetLocation();\n$user-\u003egetPinnedTweetId();\n$user-\u003egetProfileImageUrl();\n$user-\u003egetUrl();\n$user-\u003eisVerified();\n$user-\u003eisProtected();\n$user-\u003egetEntities();\n```\n\n##### Getting a User's Liked Tweets\n\n```php\n\nuse UtxoOne\\TwitterUltimatePhp\\Clients\\UserClient;\n\n$client = new UserClient(bearerToken: $_ENV['TWITTER_BEARER_TOKEN']);\n\n$user = $client-\u003egetUserByUsername('utxoone');\n$likedTweets = $client-\u003egetLikedTweets($user-\u003egetId())-\u003eall();\n\nforeach ($likedTweets as $likedTweet) {\n  $likedTweet-\u003egetId();\n  $likedTweet-\u003egetText();\n  // ...\n}\n```\n#### Follow a User\n\n```php\nuse UtxoOne\\TwitterUltimatePhp\\Clients\\UserClient;\n\n$client = new UserClient(\n    apiKey: $_ENV['TWITTER_API_KEY'], \n    apiSecret: $_ENV['TWITTER_API_SECRET'], \n    accessToken: $_ENV['TWITTER_ACCESS_TOKEN'], \n    accessSecret: $_ENV['TWITTER_ACCESS_SECRET'],\n);\n\n$user = $client-\u003egetUserByUsername('utxo_one');\n$tweet = $client-\u003efollow($user-\u003egetId());\n\n```\n\n##### Available Methods\n\n - `getUserByUsername()`\n - `getUserById()`\n - `getLikedTweets()`\n - `getFollowers()`\n - `getFollowing()`\n - `follow()`\n - `unfollow()`\n - `getBlocks()`\n - `block()`\n - `unblock()`\n - `mute()`\n - `unmute()`\n\n### List Management Methods\n\n##### Getting a List's Details\n\n```php\n\nuse UtxoOne\\TwitterUltimatePhp\\Clients\\ListClient;\n\n$client = new ListClient(bearerToken: $_ENV['TWITTER_BEARER_TOKEN']);\n\n$list = $client-\u003egetList('64651656516516516');\n$list-\u003egetId();\n$list-\u003egetFollowerCount();\n$list-\u003egetCreatedAt();\n$list-\u003egetMemberCount();\n$list-\u003eisPrivate();\n$list-\u003egetDescription();\n$list-\u003egetOwnerId();\n\n```\n\n#### Create a List\n\n```php\nuse UtxoOne\\TwitterUltimatePhp\\Clients\\ListClient;\n\n$client = new ListClient(\n    apiKey: $_ENV['TWITTER_API_KEY'], \n    apiSecret: $_ENV['TWITTER_API_SECRET'], \n    accessToken: $_ENV['TWITTER_ACCESS_TOKEN'], \n    accessSecret: $_ENV['TWITTER_ACCESS_SECRET'],\n);\n\n$list = $client-\u003ecreateList(\n  name: 'My New List',\n  description: 'My New List Description',\n  private: false,\n);\n\n$list-\u003egetId();\n\n```\n\n#### Available Methods\n\n - `getList()`\n - `getUserOwnedLists()`\n - `getListTweets()`\n - `getListMembers()`\n - `getUserMemberships()`\n - `getListFollowers()`\n - `getUserFollowedLists()`\n - `getUserPinnedLists()`\n - `createList()`\n - `updateList()`\n - `deleteList()`\n - `addListMember()`\n - `removeListMember()`\n - `followList()`\n - `unfollowList()`\n - `pinList()`\n - `unpinList()`\n\n ### Space Management Methods\n\n##### Getting a Space's Details\n\n```php\n\nuse UtxoOne\\TwitterUltimatePhp\\Clients\\SpaceClient;\n\n$client = new SpaceClient(bearerToken: $_ENV['TWITTER_BEARER_TOKEN']);\n\n$space = $client-\u003egetSpace('64651656516516516');\n$space-\u003egetId();\n$space-\u003egetTitle();\n$space-\u003egetCreatedAt();\n$space-\u003egetUpdatedAt();\n$space-\u003egetHostIds();\n$space-\u003egetState();\n$space-\u003eisTicketed();\n$space-\u003egetLand();\n$space-\u003egetCreatorId();\n\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Futxo-one%2Ftwitter-ultimate-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Futxo-one%2Ftwitter-ultimate-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Futxo-one%2Ftwitter-ultimate-php/lists"}