A PHP library for seamless integration with the Threads API by Meta. This package provides a simple and intuitive interface for interacting with the API, making it easy to integrate with PHP applications.
- Publishing: Upload and publish Threads media objects and check their status.
- Media Retrieval: Retrieve Threads media objects.
- Reply Management: Retrieve replies and conversations and hide/unhide replies.
- User: Retrieve a Threads user's posts, publishing limit, and profile.
- Insights: Retrieve insights for Threads media objects and users.
- Authentication: Issue - Support for OAuth2 authentication.
- PHP 8.1 or higher
Installation is done via Composer. Simply run the following command:
composer require trukes/threads-api-php-client
Before using the API, you need to create a client:
require 'vendor/autoload.php';
use Trukes\ThreadsApiPhpClient\Threads;
$client = Threads::client('<your_token_here>');
$create = $client->publish()->create(
'threads_user_id',
'media_type',
'text',
'image_url',
'video_url',
'is_carousel_item',
'children',
'reply_to_id',
'reply_control',
'allowlisted_country_codes',
'all_text',
)->data();
echo 'Post created successfully. Media container ID: ' . $response['id'];
$create = $client->publish()->publish(
'threads_user_id',
'129984213'
)->data();
echo 'Post created successfully. Media container ID: ' . $response['id'];
Complete META Threads documentation can be found here.
Complete documentation can be found here.
Contributions are welcome! If you have suggestions, fixes, or improvements, feel free to open an issue or a pull request.
- Fork the repository.
- Create a new branch for your feature (
git checkout -b feature/new-feature
). - Commit your changes (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature/new-feature
). - Open a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
If you have any questions or suggestions, feel free to contact us at [email protected].
If this project helped you or you find it useful, please give it a star ⭐️ on GitHub. It helps others discover the project and motivates us to continue developing and improving it.
Made with ❤️ by Trukes (https://github.com/Trukes).