Skip to content

Commit 9b540f6

Browse files
committed
added CLAUDE.md
1 parent bc5bba5 commit 9b540f6

2 files changed

Lines changed: 28 additions & 1 deletion

File tree

CLAUDE.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Overview
6+
7+
X for PHP (`dg/twitter-php`) — a PHP library for the X (formerly Twitter) API v2 using OAuth 1.0a authentication. Requires PHP 8.2+ and Guzzle HTTP client.
8+
9+
## Architecture
10+
11+
Two source files in `src/`:
12+
13+
- **`Client.php`** — Main API client (`DG\X\Client`). All X operations: `sendTweet()`, `deleteTweet()`, `getTweet()`, `getMyTweets()`, `getTimeline()`, `getMentions()`, `search()`, `getUser()`, `getUserById()`, `getFollowers()`, `follow()`, `sendDirectMessage()`, plus generic `request()` for any v2 endpoint. Uses Guzzle for HTTP, inline OAuth 1.0a signing, optional file-based caching. Backward compatibility aliases for `DG\Twitter\Twitter` and `Twitter` at file bottom.
14+
- **`Exception.php`**`DG\X\Exception` with aliases for `DG\Twitter\Exception` and `TwitterException`.
15+
16+
Autoloading uses classmap. Media upload still uses Twitter API v1.1 endpoint (`upload.twitter.com`).
17+
18+
## Commands
19+
20+
```bash
21+
composer tester # run tests (Nette Tester)
22+
composer phpstan # run PHPStan level 8
23+
```
24+
25+
## Testing
26+
27+
Tests in `tests/Client/` using Nette Tester (`.phpt` files). Unit tests run always; integration tests require env vars `X_CONSUMER_KEY`, `X_CONSUMER_SECRET`, `X_ACCESS_TOKEN`, `X_ACCESS_TOKEN_SECRET` and are skipped otherwise.

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ $tweets = $x->getMentions();
119119
The static method `Client::clickable()` makes links, mentions and hashtags in tweets clickable:
120120

121121
```php
122-
foreach ($tweets->data as $tweet) {
122+
foreach ($tweets as $tweet) {
123123
echo Client::clickable($tweet);
124124
}
125125
```

0 commit comments

Comments
 (0)