PHP Classes

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

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 46%Total: 76 All time: 10,170 This week: 80Up
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: 10 packages by
Country: Pakistan Pakistan
Age: ???
All time rank: 244033 in Pakistan Pakistan
Week rank: 53 Up2 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 (8)  
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 (8)  /  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 (8)  /  Twitter  /  Lists  
File Role Description
  Plain text file Lists.php Class Class source

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

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:76
This week:0
All time:10,170
This week:80Up
 User Ratings  
 
 All time
Utility:58%StarStarStar
Consistency:58%StarStarStar
Documentation:58%StarStarStar
Examples:58%StarStarStar
Tests:-
Videos:-
Overall:46%StarStarStar
Rank:3151