Codebird\Codebird
A Twitter library in PHP.
Synopsis
class Codebird
{
- // members
- private static $_instance = NULL;
- protected static $_oauth_consumer_key = NULL;
- protected static $_oauth_consumer_secret = NULL;
- protected static $_oauth_bearer_token = NULL;
- protected static string $_endpoint = 'https://api.twitter.com/1.1/';
- protected static string $_endpoint_media = 'https://upload.twitter.com/1.1/';
- protected static string $_endpoint_oauth = 'https://api.twitter.com/';
- protected static string $_endpoint_old = 'https://api.twitter.com/1/';
- protected $_oauth_token = NULL;
- protected $_oauth_token_secret = NULL;
- protected $_return_format = CODEBIRD_RETURNFORMAT_OBJECT;
- protected array $_supported_media_files = ;
- protected string $_version = '2.5.0-rc.2';
- protected $_timeout;
- protected $_connectionTimeout;
- // methods
- public static Codebird getInstance()
- public static void setConsumerKey()
- public static void setBearerToken()
- public string getVersion()
- public void setToken()
- public void setTimeout()
- public void setConnectionTimeout()
- public void setReturnFormat()
- public mixed __call()
- public string oauth_authenticate()
- public string oauth_authorize()
- public string oauth2_token()
- private null|array _getRateLimitInfo()
- private void _validateSslCertificate()
- private mixed _url()
- private string _sha1()
- protected string _nonce()
- protected string _sign()
- protected string _detectMethod()
- protected bool _detectMultipart()
- protected null|string _buildMultipart()
- protected bool _detectInternal()
- protected bool _detectMedia()
- protected bool _detectOld()
- protected string _getEndpoint()
- protected mixed _callApi()
- protected array|object _parseApiReply()
Members
private
-
$_instance
The current singleton instance
protected
-
$_connectionTimeout
Connection timeout -
$_endpoint
The API endpoint to use -
$_endpoint_media
The media API endpoint to use -
$_endpoint_oauth
The API endpoint base to use -
$_endpoint_old
The API endpoint to use for old requests -
$_oauth_bearer_token
The app-only bearer token. Used to authorize app-only requests -
$_oauth_consumer_key
The OAuth consumer key of your registered app -
$_oauth_consumer_secret
The corresponding consumer secret -
$_oauth_token
The Request or access token. Used to sign requests -
$_oauth_token_secret
The corresponding request or access token secret -
$_return_format
The format of data to return from API calls -
$_supported_media_files
The file formats that Twitter accepts as image uploads -
$_timeout
Request timeout -
$_version
The current Codebird version
Methods
private
- _getRateLimitInfo() — Extract rate-limiting data from response headers
- _sha1() — Gets the base64-encoded SHA1 hash for the given data
- _url() — URL-encodes the given data
- _validateSslCertificate() — Check if there were any SSL certificate errors
protected
- _buildMultipart() — Detect filenames in upload parameters, build multipart request from upload params
- _callApi() — Calls the API using cURL
- _detectInternal() — Detects if API call is internal
- _detectMedia() — Detects if API call should use media endpoint
- _detectMethod() — Detects HTTP method to use for API call
- _detectMultipart() — Detects if API call should use multipart/form-data
- _detectOld() — Detects if API call should use old endpoint
- _getEndpoint() — Builds the complete API endpoint url
- _nonce() — Generates a (hopefully) unique random string
- _parseApiReply() — Parses the API reply to encode it in the set return_format
- _sign() — Generates an OAuth signature
public
- __call() — Main API handler working on any requests you issue
- getInstance() — Returns singleton class instance Always use this method unless you're working with multiple authenticated users at once
- getVersion() — Gets the current Codebird version
- oauth2_token() — Gets the OAuth bearer token
- oauth_authenticate() — Gets the OAuth authenticate URL for the current request token
- setBearerToken() — Sets the OAuth2 app-only auth bearer token
- setConnectionTimeout() — Sets connection timeout in milliseconds
- setConsumerKey() — Sets the OAuth consumer key and secret (App key)
- setReturnFormat() — Sets the format for API replies
- setTimeout() — Sets request timeout in milliseconds
- setToken() — Sets the OAuth request or access token and secret (User key)