TijsVerkoyen\Twitter\Twitter::followersIds PHP Method

followersIds() public method

At this time, results are ordered with the most recent following first — however, this ordering is subject to unannounced change and eventual consistency issues. Results are given in groups of 5,000 user IDs and multiple "pages" of results can be navigated through using the next_cursor value in subsequent requests. See Using cursors to navigate collections for more information. This method is especially powerful when used in conjunction with GET users/lookup, a method that allows you to convert user IDs into full user objects in bulk.
public followersIds ( string[optional] $userId = null, string[optional] $screenName = null, string[optional] $cursor = null, bool[optional] $stringifyIds = true ) : array
$userId string[optional]
$screenName string[optional]
$cursor string[optional]
$stringifyIds bool[optional]
return array
    public function followersIds($userId = null, $screenName = null, $cursor = null, $stringifyIds = true)
    {
        // validate
        if ($userId == '' && $screenName == '') {
            throw new Exception('Specify an userId or a screenName.');
        }
        // build parameters
        if ($userId != null) {
            $parameters['user_id'] = (string) $userId;
        }
        if ($screenName != null) {
            $parameters['screen_name'] = (string) $screenName;
        }
        if ($cursor != null) {
            $parameters['cursor'] = (string) $cursor;
        }
        $parameters['stringify_ids'] = (bool) $stringifyIds ? 'true' : 'false';
        // make the call
        return $this->doCall('followers/ids.json', $parameters, true);
    }

Usage Example

 /**
  * Tests Twitter->followersIds
  */
 public function testFollowersIds()
 {
     $response = $this->twitter->followersIds(null, 'tijsverkoyen');
     $this->assertArrayHasKey('ids', $response);
     $this->assertArrayHasKey('next_cursor', $response);
     $this->assertArrayHasKey('previous_cursor', $response);
 }
Twitter