PHP 클래스 App\services\RESTfulService

파일 보기 프로젝트 열기: phanan/koel 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$client Client; The GuzzleHttp client to talk to the API.
$endpoint string The API endpoint.
$key string The API key.
$keyParam string For example, Last.fm use api_key, like this: https://ws.audioscrobbler.com/2.0?method=artist.getInfo&artist=Kamelot&api_key=API_KEY.
$responseFormat
$secret string The API secret.

공개 메소드들

메소드 설명
__call ( string $method, array $args ) : object Make an HTTP call to the external resource.
__construct ( $key, $secret, $endpoint, Client $client )
buildUrl ( string $uri, boolean $appendKey = true ) : string Turn a URI segment into a full API URL.
getClient ( ) : Client
getEndpoint ( ) : string
getKey ( ) : string
getSecret ( ) : string
request ( string $verb, string $uri, boolean $appendKey = true, array $params = [] ) : object | string Make a request to the API.
setClient ( Client $client )
setEndpoint ( string $endpoint )
setKey ( string $key )
setSecret ( string $secret )

메소드 상세

__call() 공개 메소드

Make an HTTP call to the external resource.
public __call ( string $method, array $args ) : object
$method string The HTTP method
$args array An array of parameters
리턴 object

__construct() 공개 메소드

public __construct ( $key, $secret, $endpoint, Client $client )
$client GuzzleHttp\Client

buildUrl() 공개 메소드

Turn a URI segment into a full API URL.
public buildUrl ( string $uri, boolean $appendKey = true ) : string
$uri string
$appendKey boolean Whether to automatically append the API key into the URL.
리턴 string

getClient() 공개 메소드

public getClient ( ) : Client
리턴 GuzzleHttp\Client

getEndpoint() 공개 메소드

public getEndpoint ( ) : string
리턴 string

getKey() 공개 메소드

public getKey ( ) : string
리턴 string

getSecret() 공개 메소드

public getSecret ( ) : string
리턴 string

request() 공개 메소드

Make a request to the API.
public request ( string $verb, string $uri, boolean $appendKey = true, array $params = [] ) : object | string
$verb string The HTTP verb
$uri string The API URI (segment)
$appendKey boolean Whether to automatically append the API key into the URI. While it's usually the case, some services (like Last.fm) requires an "API signature" of the request. Appending an API key will break the request.
$params array An array of parameters
리턴 object | string

setClient() 공개 메소드

public setClient ( Client $client )
$client GuzzleHttp\Client

setEndpoint() 공개 메소드

public setEndpoint ( string $endpoint )
$endpoint string

setKey() 공개 메소드

public setKey ( string $key )
$key string

setSecret() 공개 메소드

public setSecret ( string $secret )
$secret string

프로퍼티 상세

$client 보호되어 있는 프로퍼티

The GuzzleHttp client to talk to the API.
protected Client; $client
리턴 Client;

$endpoint 보호되어 있는 프로퍼티

The API endpoint.
protected string $endpoint
리턴 string

$key 보호되어 있는 프로퍼티

The API key.
protected string $key
리턴 string

$keyParam 보호되어 있는 프로퍼티

For example, Last.fm use api_key, like this: https://ws.audioscrobbler.com/2.0?method=artist.getInfo&artist=Kamelot&api_key=API_KEY.
protected string $keyParam
리턴 string

$responseFormat 보호되어 있는 프로퍼티

protected $responseFormat

$secret 보호되어 있는 프로퍼티

The API secret.
protected string $secret
리턴 string