PHP 클래스 TTools\App

파일 보기 프로젝트 열기: ttools/ttools

공개 메소드들

메소드 설명
__construct ( array $config, TTools\Provider\StorageProviderInterface $sp = null, TTools\Provider\RequestProviderInterface $rp = null )
destroy ( string $tweet_id ) : array | mixed Destroy a tweet
get ( $path, array $params = [] ) : array Performs a GET request to the Twitter API
getCredentials ( ) : array Get logged user profile
getCurrentUser ( ) : User Gets the current logged user, if any.
getFavorites ( integer $limit = 10 ) : array Gets current user favorites
getLastReqInfo ( ) : array Gets information about the last request.
getLoggedUser ( ) : User Returns a User object with ArrayAccess. Returns null if there's no logged user.
getLoginUrl ( string $callbackUrl = null ) : string
getMentions ( integer $limit = 10 ) : array Gets mentions for the current user
getProfile ( array $params = null ) : array Gets a user profile. If you want to get another user's profile, you just need to provide an array with either the 'user_id' or the 'screen_name' .
getRemainingCalls ( ) : array Returns information about the API usage and how many calls you have left.
getState ( ) : integer Returns current state
getTimeline ( integer $limit = 10 ) : array Gets the home timeline for current authenticated user
getTweet ( string $tweet_id ) : array Gets a specific Tweet
getUser ( ) : User Retrieves the Twitter User. If there's no logged user yet, it will check if the user is coming back from the Twitter Auth page and retrieve its tokens.
getUserTimeline ( null $user_id = null, null $screen_name = null, integer $limit = 10 ) : array Gets a user timeline (tweets posted by a user). Defaults to the current user timeline
getUserTokens ( ) : array
isLogged ( ) : integer
linkify ( string $message ) : string Renders links, hash tags, and account mentions of a Tweet message as clickable links
logout ( ) : mixed
post ( $path, $params, boolean $multipart = false ) : array Performs a POST request to the Twitter API
update ( string $message, string $in_reply_to = null, $media = [] ) : array Post a tweet
updateWithMedia ( string $image, string $message, string $in_reply_to = null ) : array Post a tweet with an image embedded - to keep backwards compatibility
uploadMedia ( string $image ) : array Uploads media to uploads.twitter.com to be embedded in tweets

비공개 메소드들

메소드 설명
setState ( $state ) Internal - Sets current state.

메소드 상세

__construct() 공개 메소드

public __construct ( array $config, TTools\Provider\StorageProviderInterface $sp = null, TTools\Provider\RequestProviderInterface $rp = null )
$config array
$sp TTools\Provider\StorageProviderInterface
$rp TTools\Provider\RequestProviderInterface

destroy() 공개 메소드

Destroy a tweet
public destroy ( string $tweet_id ) : array | mixed
$tweet_id string The ID of the tweet
리턴 array | mixed

get() 공개 메소드

Performs a GET request to the Twitter API
public get ( $path, array $params = [] ) : array
$path
$params array
리턴 array

getCredentials() 공개 메소드

Get logged user profile
public getCredentials ( ) : array
리턴 array

getCurrentUser() 공개 메소드

Gets the current logged user, if any.
public getCurrentUser ( ) : User
리턴 User

getFavorites() 공개 메소드

Gets current user favorites
public getFavorites ( integer $limit = 10 ) : array
$limit integer
리턴 array

getLastReqInfo() 공개 메소드

Gets information about the last request.
public getLastReqInfo ( ) : array
리턴 array

getLoggedUser() 공개 메소드

Returns a User object with ArrayAccess. Returns null if there's no logged user.
public getLoggedUser ( ) : User
리턴 User

getLoginUrl() 공개 메소드

public getLoginUrl ( string $callbackUrl = null ) : string
$callbackUrl string Absolute URL which Twitter redirects to after the user successfully connected with the app
리턴 string

getMentions() 공개 메소드

Gets mentions for the current user
public getMentions ( integer $limit = 10 ) : array
$limit integer
리턴 array

getProfile() 공개 메소드

Example: $profile = $ttools->getProfile(array('screen_name' => 'erikaheidi));
public getProfile ( array $params = null ) : array
$params array The twitter user ID or screen_name(optional)
리턴 array

getRemainingCalls() 공개 메소드

Returns information about the API usage and how many calls you have left.
public getRemainingCalls ( ) : array
리턴 array

getState() 공개 메소드

Returns current state
public getState ( ) : integer
리턴 integer

getTimeline() 공개 메소드

Gets the home timeline for current authenticated user
public getTimeline ( integer $limit = 10 ) : array
$limit integer
리턴 array

getTweet() 공개 메소드

Gets a specific Tweet
public getTweet ( string $tweet_id ) : array
$tweet_id string The tweet id
리턴 array

getUser() 공개 메소드

Retrieves the Twitter User. If there's no logged user yet, it will check if the user is coming back from the Twitter Auth page and retrieve its tokens.
public getUser ( ) : User
리턴 User Returns a TTools User object or null if there's no logged user.

getUserTimeline() 공개 메소드

Gets a user timeline (tweets posted by a user). Defaults to the current user timeline
public getUserTimeline ( null $user_id = null, null $screen_name = null, integer $limit = 10 ) : array
$user_id null If specified, will try to get this user id tweets
$screen_name null If specified, will try to get this user screen_name tweets
$limit integer
리턴 array

getUserTokens() 공개 메소드

public getUserTokens ( ) : array
리턴 array

isLogged() 공개 메소드

public isLogged ( ) : integer
리턴 integer

linkify() 공개 메소드

Renders links, hash tags, and account mentions of a Tweet message as clickable links
public linkify ( string $message ) : string
$message string The tweet message
리턴 string

logout() 공개 메소드

public logout ( ) : mixed
리턴 mixed

post() 공개 메소드

Performs a POST request to the Twitter API
public post ( $path, $params, boolean $multipart = false ) : array
$path
$params
$multipart boolean
리턴 array

update() 공개 메소드

Post a tweet
public update ( string $message, string $in_reply_to = null, $media = [] ) : array
$message string The tweet message
$in_reply_to string [optional] A tweet id that this post is replying to. Twitter ignores this param if you don't mention the user in the tweet message.
리턴 array

updateWithMedia() 공개 메소드

Post a tweet with an image embedded - to keep backwards compatibility
public updateWithMedia ( string $image, string $message, string $in_reply_to = null ) : array
$image string Path to the image file
$message string Message to be posted with the image
$in_reply_to string [optional] A tweet id that this post is replying to. Twitter ignores this param if you don't mention the user in the tweet message.
리턴 array

uploadMedia() 공개 메소드

Uploads media to uploads.twitter.com to be embedded in tweets
public uploadMedia ( string $image ) : array
$image string Path to the image/media file
리턴 array Response