PHP Class OAuthSimple, oauthsimple

https://github.com/jrconlin/oauthsimple
Author: jr conlin ([email protected])
ファイルを表示 Open project: jrconlin/oauthsimple Class Usage Examples

Public Properties

Property Type Description
$path
$sbs

Public Methods

Method Description
__construct ( string $APIKey = "", string $sharedSecret = "" ) : OAuthSimple Constructor
getHeaderString ( array $args = [] ) : string Return a formatted "header" string
reset ( ) : OAuthSimple Reset the parameters and URL
setAction ( string $action ) : OAuthSimple Set the "action" for the url, (e.g. GET,POST, DELETE, etc.)
setParameters ( string | array | object $parameters = [] ) : OAuthSimple Set the parameters either from a hash or a string
setPath ( string $path ) : mixed Convenience method for setURL
setQueryString ( $parameters ) : OAuthSimple Convenience method for setParameters
setSignatureMethod ( string $method = "" ) : string Set the signature method (currently only Plaintext or SHA-MAC1)
setTokensAndSecrets ( $signatures ) : OAuthSimple
setURL ( string $path ) : OAuthSimple Set the target URL (does not include the parameters)
sign ( array $args = [] ) : array sign the request
signatures ( $signatures ) : OAuthSimple Set the signatures (as well as validate the ones you have)

Private Methods

Method Description
_generateSignature ( $parameters = "" )
_getAccessToken ( )
_getApiKey ( )
_getNonce ( $length = 5 )
_getTimeStamp ( )
_normalizedParameters ( )
_oauthEscape ( $string )
_parseParameterString ( $paramString )

Method Details

__construct() public method

Constructor
public __construct ( string $APIKey = "", string $sharedSecret = "" ) : OAuthSimple
$APIKey string The API Key (sometimes referred to as the consumer key) This value is usually supplied by the site you wish to use.
$sharedSecret string The shared secret. This value is also usually provided by the site you wish to use.
return OAuthSimple

getHeaderString() public method

NOTE: This doesn't set the "Authorization: " prefix, which is required. It's not set because various set header functions prefer different ways to do that.
public getHeaderString ( array $args = [] ) : string
$args array
return string

reset() public method

Reset the parameters and URL
public reset ( ) : OAuthSimple
return OAuthSimple

setAction() public method

Set the "action" for the url, (e.g. GET,POST, DELETE, etc.)
public setAction ( string $action ) : OAuthSimple
$action string HTTP Action word.
return OAuthSimple

setParameters() public method

Set the parameters either from a hash or a string
public setParameters ( string | array | object $parameters = [] ) : OAuthSimple
$parameters string | array | object List of parameters for the call, this can either be a URI string (e.g. "foo=bar&gorp=banana" or an object/hash)
return OAuthSimple

setPath() public method

Convenience method for setURL
See also: setURL
public setPath ( string $path ) : mixed
$path string
return mixed

setQueryString() public method

Convenience method for setParameters
See also: setParameters
public setQueryString ( $parameters ) : OAuthSimple
$parameters
return OAuthSimple

setSignatureMethod() public method

Set the signature method (currently only Plaintext or SHA-MAC1)
public setSignatureMethod ( string $method = "" ) : string
$method string Method of signing the transaction (only PLAINTEXT and SHA-MAC1 allowed for now)
return string OAuthSimple

setTokensAndSecrets() public method

public setTokensAndSecrets ( $signatures ) : OAuthSimple
$signatures
return OAuthSimple

setURL() public method

Set the target URL (does not include the parameters)
public setURL ( string $path ) : OAuthSimple
$path string The fully qualified URI (excluding query arguments) (e.g "http://example.org/foo")
return OAuthSimple

sign() public method

note: all arguments are optional, provided you've set them using the other helper functions.
public sign ( array $args = [] ) : array
$args array hash of arguments for the call {action, path, parameters (array), method, signatures (array)} all arguments are optional.
return array signed values

signatures() public method

Set the signatures (as well as validate the ones you have)
public signatures ( $signatures ) : OAuthSimple
$signatures (object) object/hash of the token/signature pairs {api_key:, shared_secret:, oauth_token: oauth_secret:}
return OAuthSimple

Property Details

$path public_oe property

public $path

$sbs public_oe property

public $sbs