GitHub - codeChap/x: A simple PHP library for posting to X (Twitter) using API v2. | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

codeChap/x

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP X (Everything App) API Post Library

A simple PHP library for posting to X (Formerly Twitter) using the free tier.

Installation

composer require codechap/x:dev-master

Example

<?php

require 'vendor/autoload.php';

use codechap\x\X;
use codechap\x\Msg;

// Create thread messages
$threadPartA = new Msg();
$threadPartA->set('content', 'Hello, X!');
$threadPartA->set('image', 'img-HrW6drkAzh4UqUaXD3o3H.jpeg');

$threadPartB = new Msg();
$threadPartB->set('content', 'Hello, X! This is the second message.');
$threadPartB->set('image', 'img-HrW6drkAzh4UqUaXD3o3H.jpeg');

// Initialize X client for thread
$threadPoster = new X();
$threadPoster->set('apiKey', $apiKey);
$threadPoster->set('apiKeySecret', $apiKeySecret);
$threadPoster->set('accessToken', $accessToken);
$threadPoster->set('accessTokenSecret', $accessTokenSecret);

// Post thread
$thread = [$threadPartA, $threadPartB];
$threadPoster->post($thread);
echo "Thread posted successfully!\n";
<?php

require 'vendor/autoload.php';

use codechap\x\X;
use codechap\x\Msg;

// Single post example
$post = new X();
$post->set('apiKey', $apiKey);
$post->set('apiKeySecret', $apiKeySecret);
$post->set('accessToken', $accessToken);
$post->set('accessTokenSecret', $accessTokenSecret);

$msg = new Msg();
$msg->set('content', 'Hello, X!');
$msg->set('image', 'img-HrW6drkAzh4UqUaXD3o3H.jpeg');

$post->post($msg);
echo "Single post successful!";
<?php

require 'vendor/autoload.php';

use codechap\x\X;

// Get your user info
$client = new X();
$client->set('apiKey', $apiKey);
$client->set('apiKeySecret', $apiKeySecret);
$client->set('accessToken', $accessToken);
$client->set('accessTokenSecret', $accessTokenSecret);
$userInfo = $client->me();
echo "Hello, " . $userInfo['data']['name'] . "!\n";

About

A simple PHP library for posting to X (Twitter) using API v2.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.