PHPackages                             carmelosantana/coqui-toolkit-x - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. carmelosantana/coqui-toolkit-x

ActiveLibrary[API Development](/categories/api)

carmelosantana/coqui-toolkit-x
==============================

X (Twitter) management toolkit for Coqui Bot — post tweets, read timelines, search, manage followers, likes, bookmarks, and mutes via the X API v2.

v0.1.1(1mo ago)00MITPHPPHP ^8.4CI passing

Since Apr 9Pushed 1mo agoCompare

[ Source](https://github.com/carmelosantana/coqui-x)[ Packagist](https://packagist.org/packages/carmelosantana/coqui-toolkit-x)[ RSS](/packages/carmelosantana-coqui-toolkit-x/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (3)Used By (0)

Coqui Toolkit: X (Twitter)
==========================

[](#coqui-toolkit-x-twitter)

Comprehensive X (Twitter) management toolkit for [Coqui](https://github.com/carmelosantana/coqui). Provides X API v2 access for tweets, timelines, search, user lookup, followers, likes, bookmarks, and mutes.

Requirements
------------

[](#requirements)

- PHP 8.4+
- Coqui Bot with `carmelosantana/php-agents` ^0.7

Installation
------------

[](#installation)

```
composer require coquibot/coqui-toolkit-x
```

The toolkit is auto-discovered by Coqui via `extra.php-agents.toolkits` in `composer.json`.

Configuration
-------------

[](#configuration)

### Required Credentials

[](#required-credentials)

CredentialDescription`X_BEARER_TOKEN`Bearer token for read operations (search, timelines, user lookup). Get one at [X Developer Dashboard](https://developer.x.com/en/portal/dashboard).### Optional Credentials (for write operations)

[](#optional-credentials-for-write-operations)

CredentialDescription`X_CONSUMER_KEY`API Key (Consumer Key) for write operations`X_CONSUMER_SECRET`API Secret (Consumer Secret) for write operations`X_ACCESS_TOKEN`User Access Token for write operations`X_ACCESS_TOKEN_SECRET`User Access Token Secret for write operationsSet credentials via the Coqui `credentials` tool:

```
credentials(action: "set", key: "X_BEARER_TOKEN", value: "your-bearer-token")
credentials(action: "set", key: "X_CONSUMER_KEY", value: "your-consumer-key")
credentials(action: "set", key: "X_CONSUMER_SECRET", value: "your-consumer-secret")
credentials(action: "set", key: "X_ACCESS_TOKEN", value: "your-access-token")
credentials(action: "set", key: "X_ACCESS_TOKEN_SECRET", value: "your-access-token-secret")

```

### Authentication Modes

[](#authentication-modes)

The toolkit supports two authentication modes:

- **Bearer Token** (read-only): With just `X_BEARER_TOKEN`, you can search tweets, read timelines, and look up users. This is the minimum required credential.
- **OAuth 1.0a** (read + write): With all 5 credentials, you can also post tweets, like, follow, bookmark, and mute. The toolkit uses HMAC-SHA1 signing for OAuth 1.0a.

### X Developer App Setup

[](#x-developer-app-setup)

1. Go to the [X Developer Portal](https://developer.x.com/en/portal/dashboard)
2. Create a Project and App
3. Enable Read and Write permissions
4. Generate your Bearer Token, Consumer Keys, and Access Tokens
5. Set them via the Coqui `credentials` tool

Tools
-----

[](#tools)

### `x_tweet`

[](#x_tweet)

Create, delete, reply to, retweet, quote, and fetch tweets.

**Actions:** `create`, `delete`, `reply`, `retweet`, `quote`, `get`

ParameterTypeRequiredDescription`action`enumyesOperation to perform`text`stringfor create/reply/quoteTweet text content`tweet_id`stringfor delete/reply/retweet/quote/getTarget tweet ID`poll_options`stringnoComma-separated poll options (2-4)`poll_duration`numbernoPoll duration in minutes (max 10080)### `x_timeline`

[](#x_timeline)

Read user tweet timelines, mentions, and home feed.

**Actions:** `user_tweets`, `mentions`, `reverse_chronological`

ParameterTypeRequiredDescription`action`enumyesTimeline type`user_id`stringfor user\_tweets/mentionsTarget user ID`max_results`numbernoResults per page (1-100, default 10)`pagination_token`stringnoNext page token### `x_search`

[](#x_search)

Search for recent tweets matching a query with full X search syntax support.

**Actions:** `recent`, `counts`

ParameterTypeRequiredDescription`action`enumyesSearch operation`query`stringyesSearch query with operator support`max_results`numbernoResults to return (10-100, default 10)`sort_order`enumno`recency` or `relevancy``next_token`stringnoNext page token**Search operators:** `#hashtag`, `@mention`, `"exact phrase"`, `from:user`, `to:user`, `lang:en`, `has:media`, `has:links`, `is:retweet`, `-exclude`

### `x_user`

[](#x_user)

Look up X user profiles by ID, username, or get the authenticated user.

**Actions:** `me`, `get`, `by_username`

ParameterTypeRequiredDescription`action`enumyesLookup operation`user_id`stringfor getTarget user ID`username`stringfor by\_usernameUsername (without @)### `x_follower`

[](#x_follower)

List followers/following and follow/unfollow users.

**Actions:** `followers`, `following`, `follow`, `unfollow`

ParameterTypeRequiredDescription`action`enumyesFollower operation`user_id`stringfor followers/followingTarget user ID`target_user_id`stringfor follow/unfollowUser to follow/unfollow`max_results`numbernoResults per page (1-1000, default 100)`pagination_token`stringnoNext page token### `x_like`

[](#x_like)

Like/unlike tweets, list liked tweets and users who liked a tweet.

**Actions:** `like`, `unlike`, `liked_tweets`, `liking_users`

ParameterTypeRequiredDescription`action`enumyesLike operation`tweet_id`stringfor like/unlike/liking\_usersTarget tweet ID`user_id`stringfor liked\_tweetsTarget user ID`max_results`numbernoResults per page### `x_bookmark`

[](#x_bookmark)

Manage bookmarked tweets.

**Actions:** `list`, `add`, `remove`

ParameterTypeRequiredDescription`action`enumyesBookmark operation`tweet_id`stringfor add/removeTarget tweet ID`max_results`numbernoResults per page (1-100, default 10)`pagination_token`stringnoNext page token### `x_mute`

[](#x_mute)

Manage muted users.

**Actions:** `list`, `mute`, `unmute`

ParameterTypeRequiredDescription`action`enumyesMute operation`target_user_id`stringfor mute/unmuteUser to mute/unmute`max_results`numbernoResults per page (1-1000, default 100)`pagination_token`stringnoNext page tokenGated Operations
----------------

[](#gated-operations)

The following operations require user confirmation (or `--auto-approve`):

ToolGated Actions`x_tweet``create`, `delete`, `reply`, `retweet`, `quote``x_follower``follow`, `unfollow``x_like``like`, `unlike``x_bookmark``add`, `remove``x_mute``mute`, `unmute`Content Safety
--------------

[](#content-safety)

All outbound tweet content (create, reply, quote) is automatically screened for prompt injection patterns before reaching the X API:

- **Instruction overrides**: "ignore previous instructions", "you are now", "system prompt", "jailbreak"
- **Account manipulation**: "delete my account", "change my password", "revoke access"
- **Credential exfiltration**: "post my api key", "share the token", "leak credentials"

If a pattern is detected, the tweet is blocked with a clear explanation. Normal conversational content passes through without false positives.

Usage Examples
--------------

[](#usage-examples)

```
# Post a tweet
x_tweet(action: "create", text: "Hello from Coqui Bot! 🤖")

# Post a tweet with a poll
x_tweet(action: "create", text: "What's your favorite language?", poll_options: "PHP,Python,TypeScript,Rust", poll_duration: 1440)

# Reply to a tweet
x_tweet(action: "reply", tweet_id: "1234567890", text: "Great thread!")

# Search for recent tweets about a topic
x_search(action: "recent", query: "#php #ai lang:en -is:retweet", max_results: 20, sort_order: "recency")

# Get tweet volume counts
x_search(action: "counts", query: "Coqui Bot")

# Look up a user by username
x_user(action: "by_username", username: "elonmusk")

# Get your own profile
x_user(action: "me")

# Read your timeline mentions
x_timeline(action: "mentions", user_id: "YOUR_USER_ID", max_results: 20)

# Follow a user
x_follower(action: "follow", target_user_id: "123456")

# List your followers
x_follower(action: "followers", user_id: "YOUR_USER_ID", max_results: 50)

# Like a tweet
x_like(action: "like", tweet_id: "1234567890")

# Bookmark a tweet
x_bookmark(action: "add", tweet_id: "1234567890")

# Mute a user
x_mute(action: "mute", target_user_id: "123456")

```

Development
-----------

[](#development)

```
# Install dependencies
composer install

# Run tests
composer test

# Static analysis
composer analyse
```

License
-------

[](#license)

MIT

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance94

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

2

Last Release

32d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/597820?v=4)[Carmelo Santana](/maintainers/carmelosantana)[@carmelosantana](https://github.com/carmelosantana)

---

Top Contributors

[![carmelosantana](https://avatars.githubusercontent.com/u/597820?v=4)](https://github.com/carmelosantana "carmelosantana (3 commits)")

---

Tags

apitwittertoolkitsocial mediaphp-agentscoquix

###  Code Quality

TestsPest

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/carmelosantana-coqui-toolkit-x/health.svg)

```
[![Health](https://phpackages.com/badges/carmelosantana-coqui-toolkit-x/health.svg)](https://phpackages.com/packages/carmelosantana-coqui-toolkit-x)
```

###  Alternatives

[noweh/twitter-api-v2-php

This library provides methods for sending messages to Twitter and receiving statuses.

131225.2k1](/packages/noweh-twitter-api-v2-php)[makotokw/twient

Twitter Client for PHP 5.3+

2632.0k](/packages/makotokw-twient)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
