PHP Class Pantheon\Terminus\Request\Request

Handles requests made by Terminus This is simply a class to manage the interactions between Terminus and Guzzle (the HTTP library Terminus uses). This class should eventually evolve to manage all requests to external resources such. Eventually we could even log requests in debug mode.
Inheritance: implements Robo\Contract\ConfigAwareInterface, implements Pantheon\Terminus\Session\SessionAwareInterface, implements Psr\Log\LoggerAwareInterface, use trait Psr\Log\LoggerAwareTrait, use trait Robo\Common\ConfigAwareTrait, use trait Pantheon\Terminus\Session\SessionAwareTrait
Datei anzeigen Open project: pantheon-systems/terminus Class Usage Examples

Public Methods

Method Description
download ( string $url, string $target ) : boolean Download file from target URL
pagedRequest ( string $path, array $options = [] ) : array Make a request to the Dashbord's internal API
request ( string $path, array $arg_options = [] ) : array Simplified request method for Pantheon API

Private Methods

Method Description
fillCookieJar ( array $params ) : GuzzleHttp\Cookie\CookieJar Sets up and fills a cookie jar
getBaseUri ( ) : string Parses the base URI for requests
send ( string $uri, string $method, array $arg_params = [] ) : Psr\Http\Message\ResponseInterface Sends a request to the API
userAgent ( ) : string Gives the user-agent string

Method Details

download() public static method

Download file from target URL
public static download ( string $url, string $target ) : boolean
$url string URL to download from
$target string Target file's name
return boolean True if download succeeded

pagedRequest() public method

Make a request to the Dashbord's internal API
public pagedRequest ( string $path, array $options = [] ) : array
$path string API path (URL)
$options array Options for the request [string] method GET is default [mixed] data Native PHP data structure (e.g. int, string array, or simple object) to be sent along with the request. Will be encoded as JSON for you.
return array

request() public method

Simplified request method for Pantheon API
public request ( string $path, array $arg_options = [] ) : array
$path string API path (URL)
$arg_options array Options for the request [string] method GET is default [mixed] data Native PHP data structure (e.g. int, string array, or simple object) to be sent along with the request. Will be encoded as JSON for you. [boolean] absolute_url True if URL passed is to be treated as absolute
return array