PHP 클래스 Ixudra\Curl\Builder

파일 보기 프로젝트 열기: ixudra/curl

보호된 프로퍼티들

프로퍼티 타입 설명
$curlObject resource cURL request
$curlOptions array Array of cURL options
$packageOptions array Array with options that are not specific to cURL but are used by the package

공개 메소드들

메소드 설명
allowRedirect ( ) : Builder Allow for redirects in the request
asJson ( boolean $asArray = false ) : Builder Configure the package to encode and decode the request data
asJsonRequest ( ) : Builder Configure the package to encode the request data to json before sending it to the server
asJsonResponse ( boolean $asArray = false ) : Builder Configure the package to decode the request data from json to object or associative array
containsFile ( ) : Builder Enable File sending
delete ( ) : mixed Send a DELETE request to a URL using the specified cURL options
download ( string $fileName ) : mixed Send a download request to a URL using the specified cURL options
enableDebug ( string $logFile ) : Builder Enable debug mode for the cURL request
get ( ) : mixed Send a GET request to a URL using the specified cURL options
patch ( ) : mixed Send a PATCH request to a URL using the specified cURL options
post ( ) : mixed Send a POST request to a URL using the specified cURL options
put ( ) : mixed Send a PUT request to a URL using the specified cURL options
returnResponseObject ( ) : Builder Return a full response object with HTTP status and headers instead of only the content
to ( $url ) : Builder Set the URL to which the request is to be sent
withContentType ( string $contentType ) : Builder Add a content type HTTP header to the request
withData ( array $data = [] ) : Builder Add GET or POST data to the request
withHeader ( string $header ) : Builder Add a HTTP header to the request
withHeaders ( array $headers ) : Builder Add multiple HTTP header at the same time to the request
withOption ( string $key, string $value ) : Builder Set any specific cURL option
withTimeout ( integer $timeout = 30 ) : Builder Set the request timeout

보호된 메소드들

메소드 설명
appendDataToURL ( ) : string Append set data to the query string for GET and DELETE cURL requests
forgeOptions ( ) : array Convert the curlOptions to an array of usable options for the cURL request
returnResponse ( mixed $content, array $responseData = [] ) : stdClas\stdClass
send ( ) : mixed Send the request
setPostParameters ( ) Add POST parameters to the curlOptions array
withCurlOption ( string $key, string $value ) : Builder Set any specific cURL option
withPackageOption ( string $key, string $value ) : Builder Set any specific package option

메소드 상세

allowRedirect() 공개 메소드

Allow for redirects in the request
public allowRedirect ( ) : Builder
리턴 Builder

appendDataToURL() 보호된 메소드

Append set data to the query string for GET and DELETE cURL requests
protected appendDataToURL ( ) : string
리턴 string

asJson() 공개 메소드

Configure the package to encode and decode the request data
public asJson ( boolean $asArray = false ) : Builder
$asArray boolean Indicates whether or not the data should be returned as an array. Default: false
리턴 Builder

asJsonRequest() 공개 메소드

Configure the package to encode the request data to json before sending it to the server
public asJsonRequest ( ) : Builder
리턴 Builder

asJsonResponse() 공개 메소드

Configure the package to decode the request data from json to object or associative array
public asJsonResponse ( boolean $asArray = false ) : Builder
$asArray boolean Indicates whether or not the data should be returned as an array. Default: false
리턴 Builder

containsFile() 공개 메소드

Enable File sending
public containsFile ( ) : Builder
리턴 Builder

delete() 공개 메소드

Send a DELETE request to a URL using the specified cURL options
public delete ( ) : mixed
리턴 mixed

download() 공개 메소드

Send a download request to a URL using the specified cURL options
public download ( string $fileName ) : mixed
$fileName string
리턴 mixed

enableDebug() 공개 메소드

Enable debug mode for the cURL request
public enableDebug ( string $logFile ) : Builder
$logFile string The full path to the log file you want to use
리턴 Builder

forgeOptions() 보호된 메소드

Convert the curlOptions to an array of usable options for the cURL request
protected forgeOptions ( ) : array
리턴 array

get() 공개 메소드

Send a GET request to a URL using the specified cURL options
public get ( ) : mixed
리턴 mixed

patch() 공개 메소드

Send a PATCH request to a URL using the specified cURL options
public patch ( ) : mixed
리턴 mixed

post() 공개 메소드

Send a POST request to a URL using the specified cURL options
public post ( ) : mixed
리턴 mixed

put() 공개 메소드

Send a PUT request to a URL using the specified cURL options
public put ( ) : mixed
리턴 mixed

returnResponse() 보호된 메소드

protected returnResponse ( mixed $content, array $responseData = [] ) : stdClas\stdClass
$content mixed Content of the request
$responseData array Additional response information
리턴 stdClas\stdClass

returnResponseObject() 공개 메소드

Return a full response object with HTTP status and headers instead of only the content
public returnResponseObject ( ) : Builder
리턴 Builder

send() 보호된 메소드

Send the request
protected send ( ) : mixed
리턴 mixed

setPostParameters() 보호된 메소드

Add POST parameters to the curlOptions array
protected setPostParameters ( )

to() 공개 메소드

Set the URL to which the request is to be sent
public to ( $url ) : Builder
$url string The URL to which the request is to be sent
리턴 Builder

withContentType() 공개 메소드

Add a content type HTTP header to the request
public withContentType ( string $contentType ) : Builder
$contentType string The content type of the file you would like to download
리턴 Builder

withCurlOption() 보호된 메소드

Set any specific cURL option
protected withCurlOption ( string $key, string $value ) : Builder
$key string The name of the cURL option
$value string The value to which the option is to be set
리턴 Builder

withData() 공개 메소드

Add GET or POST data to the request
public withData ( array $data = [] ) : Builder
$data array Array of data that is to be sent along with the request
리턴 Builder

withHeader() 공개 메소드

Add a HTTP header to the request
public withHeader ( string $header ) : Builder
$header string The HTTP header that is to be added to the request
리턴 Builder

withHeaders() 공개 메소드

Add multiple HTTP header at the same time to the request
public withHeaders ( array $headers ) : Builder
$headers array Array of HTTP headers that must be added to the request
리턴 Builder

withOption() 공개 메소드

Set any specific cURL option
public withOption ( string $key, string $value ) : Builder
$key string The name of the cURL option
$value string The value to which the option is to be set
리턴 Builder

withPackageOption() 보호된 메소드

Set any specific package option
protected withPackageOption ( string $key, string $value ) : Builder
$key string The name of the cURL option
$value string The value to which the option is to be set
리턴 Builder

withTimeout() 공개 메소드

Set the request timeout
public withTimeout ( integer $timeout = 30 ) : Builder
$timeout integer The timeout for the request (in seconds. Default: 30 seconds)
리턴 Builder

프로퍼티 상세

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

cURL request
protected resource $curlObject
리턴 resource

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

Array of cURL options
protected array $curlOptions
리턴 array

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

Array with options that are not specific to cURL but are used by the package
protected array $packageOptions
리턴 array