PHP Classes

PHP Twitter Search PHP SDK: Search for tweets and users with Twitter API

Recommend this page to a friend!
  Info   View files Example   View files View files (8)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 75 This week: 1All time: 10,157 This week: 560Up
Version License PHP version Categories
twittersearchphpsdk 1.0Custom (specified...5PHP 5, Web services, Social Networking
Description 

Author

This package can search for tweets and users with Twitter API.

It can access the Twitter API to perform several types of operations.

Currently it can search for tweets with a given text, get the lists of a given user and get the users of a list.

Picture of Ahmed Khan
Name: Ahmed Khan <contact>
Classes: 9 packages by
Country: Pakistan Pakistan
Age: ???
All time rank: 244934 in Pakistan Pakistan
Week rank: 416 Up8 in Pakistan Pakistan Up
Innovation award
Innovation award
Nominee: 3x

Example

<?php
include "vendor/autoload.php";
use
Twitter\Lists\Lists;
$list = new Lists();
$list->setToken("sVRnCXPUplLFePmzOqqoir8oR","PzmlGmm6UoJluWupC7js2hx025IwaY8gLD4I8BanQZtwS2g2Ql");
$value = ["list_id" => $listid,
"count" => "100"];
$lists = $list->getListMembers($value);
echo
"<pre>";
print_r($lists);
echo
"</pre>";
?>


Details

Twitter API PHP-SDK

A PHP-SDK for Twitter Search API and for Twitter Rest API. Just add the library in your project.

You can clone the repository or can install it using composer.

composer require ahmedkhan847/twittersdkphp:dev-master:1.*

Once the package is installed you can use the SDK for:

  • Search in Twitter
  • Getting users List from Twitter
  • Getting memebers from the Twitter List

Set your consumer key and consumer seceret key and start searching on Twitter.

Searching in Twitter

<?php
include "vendor/autoload.php";

use Twitter\Search\Search;
$search = new Search();
$search->setToken("Consumer Key (API Key)","	Consumer Secret (API Secret)");
$value = ["q" => "twitter"];
$result = $search->search($value);
echo "<pre>";
print_r($result);
echo "</pre>";
?>

Getting User List From Twitter

<?php
include "vendor/autoload.php";

use Twitter\Lists\Lists;
$list = new Lists();
$list->setToken("Consumer Key (API Key)","	Consumer Secret (API Secret)");
$value = ["user_id" => "132646"];
$lists = $list->getUserList($value);
echo "<pre>";
print_r($lists);
echo "</pre>";
?>

Getting List memebers From Twitter List

<?php
include "vendor/autoload.php";

use Twitter\Lists\Lists;
$list = new Lists();
$list->setToken("Consumer Key (API Key)","	Consumer Secret (API Secret)");
$value = ["list_id" => "132646",
"count" => "100"];
$lists = $list->getListMembers($value);
echo "<pre>";
print_r($lists);
echo "</pre>";
?>

Calling Any Twitter API URL

<?php
include "vendor/autoload.php";

use Twitter;
$base = new Base();
$base->setToken("Consumer Key (API Key)","	Consumer Secret (API Secret)");
$value = ["user_id" => "132646"];
$result = $Base->callTwitter("get","favorites/list.json",$value);
echo "<pre>";
print_r($result);
echo "</pre>";
?>

Feel free to contribute to the master branch


  Files folder image Files  
File Role Description
Files folder imageTwitter (1 file, 2 directories)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file index.php Example Example script
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  Twitter  
File Role Description
Files folder imageLists (1 file)
Files folder imageSearch (1 file)
  Plain text file Base.php Class Class source

  Files folder image Files  /  Twitter  /  Lists  
File Role Description
  Plain text file Lists.php Class Class source

  Files folder image Files  /  Twitter  /  Search  
File Role Description
  Plain text file Search.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:75
This week:1
All time:10,157
This week:560Up