TijsVerkoyen\Twitter\Twitter::usersSearch PHP Method

usersSearch() public method

Usage note: It is only possible to retrieve the first 1000 matches from this API.
public usersSearch ( string $q, int[optional] $page = null, int[optional] $count = null, bool[optional] $includeEntities = null ) : array
$q string The search query to run against people search.
$page int[optional]
$count int[optional]
$includeEntities bool[optional]
return array
    public function usersSearch($q, $page = null, $count = null, $includeEntities = null)
    {
        // build parameters
        $parameters['q'] = (string) $q;
        if ($page != null) {
            $parameters['page'] = (int) $page;
        }
        if ($count != null) {
            $parameters['count'] = (int) $count;
        }
        if ($includeEntities !== null) {
            $parameters['include_entities'] = $includeEntities ? 'true' : 'false';
        }
        // make the call
        return $this->doCall('users/search.json', $parameters, true);
    }

Usage Example

 /**
  * Tests Twitter->usersSearch
  */
 public function testUsersSearch()
 {
     $response = $this->twitter->usersSearch('Twitter API');
     foreach ($response as $row) {
         $this->isUser($row);
     }
 }
Twitter