Logo
Logo
  • Home
  • Projects
  • Writing
  • Work
  • Request Quote
Logo

Backed by 20+ years of hands-on software development expertise, mithra62 transforms ideas into powerful, reliable solutions—designed to work exactly how you want, every time.

  • Address

    Tucson, AZ 85712
  • Email

    eric@mithra62.com
  • Contact

    +1-310-739-3322

Simple Twitter Search with PHP

  • Home
  • Writing
Simple Twitter Search with PHP
14 May 09
  • Programming

So, I've already gone into detail on the Arc90 Twitter API Service and it's pretty fun to work with. One small problem though; it's pretty big, complicated and, well, bulky. There's a lot you have to do to get something up and running.

XKCD

Enter PHPTwitterSearch; a pretty easy to use, lightweight, Twitter API Search class. It's based on the class originally developed by David Billingham, which I admit, I didn't check out so I don't know how much it's based on.

The thing I didn't really like about the Arc90 script was how complicated the search process was. In case you didn't notice, I didn't go into any detail about the search process; for precisely because it was just to complicated. I stopped having fun when working with the search functionality.

Simplicity was what immediately drew me to PHPTwitterSearch. Here's a basic example of a search:

<?php
$query = 'findme';
$search = new SWTwitterSearch();
$search = new TwitterSearch($query);
$results = $search->results();
?>

Very, very simple. The above searches the API for $query.

Here's the best part though; for a little more complication all you have to do is chain the calls together.

<?php
$search = new SWTwitterSearch();
$search = new TwitterSearch();
$results = $search->from('username')->with('hashtag')->to('username2')->results();
?>

The above searches the API for tweets from "username" with the hash string "#hashtag" that was sent to the user "username2".

The class returns an array with objects that's really basic and simple.

Recent Post

  • Budget ExpressionEngine SEO in 2025
    Budget ExpressionEngine SEO in 2025
    07 Oct, 2025
  • The Road So Far
    The Road So Far
    30 Sep, 2025
  • I'm Speaking! (...again...)
    I’m Speaking! (...again…)
    27 Apr, 2022

follow us

© Copyright 2025 | mithra62

  • Home
  • Projects
  • Writing
  • Work
  • Request Quote