Open
Conversation
Replace deprecated Twitter API v1.1 with v2 using noweh/twitter-api-v2-php. Fixes ArthurHoaro#18. - Bump PHP requirement to 7.4+ - Add noweh/twitter-api-v2-php dependency - Pin psr/http-message ^1.0 for Shaarli compatibility - Remove bundled TwitterAPIExchange library - Update error handling for v2 response format - Update CI to PHP 7.4-8.2 - Update documentation with new Twitter Developer Portal instructions
a7adb16 to
e3b7fe8
Compare
There was a problem hiding this comment.
Pull request overview
This PR migrates the Shaarli2Twitter plugin from the deprecated Twitter API v1.1 to API v2, addressing a breaking change that occurred in 2023. The migration replaces a bundled library with a modern Composer package and updates the codebase to work with current Twitter/X API requirements.
Key Changes
- Replaced bundled TwitterAPIExchange library with
noweh/twitter-api-v2-phppackage - Enhanced error handling with try-catch blocks and improved error message parsing
- Updated minimum PHP version from 7.1 to 7.4 and CI configuration to test modern PHP versions (7.4, 8.0, 8.1, 8.2)
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| shaarli2twitter/shaarli2twitter.php | Migrated tweet posting to Twitter API v2, added composer autoload, improved error handling with try-catch and updated error message parsing |
| shaarli2twitter/TwitterApi/TwitterAPIExchange.php | Removed deprecated v1.1 API library (362 lines deleted) |
| shaarli2twitter/TwitterApi/LICENSE.md | Removed license file for old bundled library |
| composer.json | Added noweh/twitter-api-v2-php ^3.0 and psr/http-message ^1.0 dependencies, bumped PHP requirement to 7.4+ |
| README.md | Updated documentation for Twitter API v2 setup process, reflecting new Developer Portal structure and requirements |
| .travis.yml | Updated CI to test PHP 7.4, 8.0, 8.1, 8.2, and nightly, changed dist from trusty to focal |
| .gitignore | Added .phpunit.result.cache to ignored files |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #18
Twitter API v1.1 was deprecated in 2023, breaking the plugin. This PR migrates to API v2 using the noweh/twitter-api-v2-php library.
Works on my Shaarli instance (0.15, PHP 8.2) 🥳
Changes
noweh/twitter-api-v2-phpComposer packagepsr/http-message: ^1.0for compatibility with Shaarli's Slim versionAPI Key and SecretandAccess Token and Secretin the dev portal matches the config options now, so it's self-explanatory I thinkBreaking changes