TijsVerkoyen\Twitter\Twitter::followersList PHP Method

followersList() 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 20 users 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.
public followersList ( string[optional] $userId = null, string[optional] $screenName = null, int[optional] $cursor = null, bool[optional] $includeEntities = null, bool[optional] $skipStatus = null ) : array
$userId string[optional]
$screenName string[optional]
$cursor int[optional]
$includeEntities bool[optional]
$skipStatus bool[optional]
return array
    public function followersList($userId = null, $screenName = null, $cursor = null, $includeEntities = null, $skipStatus = null)
    {
        // validate
        if ($userId == '' && $screenName == '') {
            throw new Exception('Specify an userId or a screenName.');
        }
        // build parameters
        $parameters = null;
        if ($userId != null) {
            $parameters['user_id'] = (string) $userId;
        }
        if ($screenName != null) {
            $parameters['screen_name'] = (string) $screenName;
        }
        if ($cursor !== null) {
            $parameters['cursor'] = (int) $cursor;
        }
        if ($includeEntities !== null) {
            $parameters['include_user_entities'] = $includeEntities ? 'true' : 'false';
        }
        if ($skipStatus !== null) {
            $parameters['skip_status'] = $skipStatus ? 'true' : 'false';
        }
        // make the call
        return $this->doCall('followers/list.json', $parameters, true);
    }

Usage Example

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