Class Github\Client


Simple yet very cool PHP GitHub client.

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__call() Github\Client
__construct() Instantiate a new GitHub client. Github\Client
api() Github\Client
authenticate() Authenticate a user for all next requests. Github\Client
clearHeaders() Clears used headers. Github\Client
getHttpClient() Github\Client
getOption() Github\Client
setEnterpriseUrl() Sets the URL of your GitHub Enterprise instance. Github\Client
setHeaders() Github\Client
setHttpClient() Github\Client
setOption() Github\Client


Hide inherited constants

ConstantValueDescriptionDefined By
AUTH_HTTP_PASSWORD 'http_password' Constant for authentication method. Indicates the new favored login method with username and password via HTTP Authentication. Github\Client
AUTH_HTTP_TOKEN 'http_token' Constant for authentication method. Indicates the new login method with with username and token via HTTP Authentication. Github\Client
AUTH_URL_CLIENT_ID 'url_client_id' Constant for authentication method. Not indicates the new login, but allows usage of unauthenticated rate limited requests for given client_id + client_secret. Github\Client
AUTH_URL_TOKEN 'url_token' Constant for authentication method. Indicates the default, but deprecated login with username and token in URL. Github\Client

Method Details

__call() public method

public Github\Api\ApiInterface __call ( $name, $args )
$name string
throws Github\Exception\InvalidArgumentException
__construct() public method

Instantiate a new GitHub client.

public void __construct ( Github\HttpClient\HttpClientInterface $httpClient null )
$httpClient null|Github\HttpClient\HttpClientInterface

Github http client

api() public method

public Github\Api\ApiInterface api ( $name )
$name string
throws Github\Exception\InvalidArgumentException
authenticate() public method

Authenticate a user for all next requests.

public void authenticate ( $tokenOrLogin, $password null, $authMethod null )
$tokenOrLogin string

GitHub private token/username/client ID

$password null|string

GitHub password/secret (optionally can contain $authMethod)

$authMethod null|string

One of the AUTH_* class constants

throws Github\Exception\InvalidArgumentException

If no authentication method was given

clearHeaders() public method

Clears used headers.

public void clearHeaders ( )
getHttpClient() public method

public Github\HttpClient\HttpClient getHttpClient ( )
getOption() public method

public mixed getOption ( $name )
$name string
throws Github\Exception\InvalidArgumentException
setEnterpriseUrl() public method

Sets the URL of your GitHub Enterprise instance.

public void setEnterpriseUrl ( $enterpriseUrl )
$enterpriseUrl string

URL of the API in the form of http(s)://hostname

setHeaders() public method

public void setHeaders ( array $headers )
$headers array
setHttpClient() public method

public void setHttpClient ( Github\HttpClient\HttpClientInterface $httpClient )
$httpClient Github\HttpClient\HttpClientInterface
setOption() public method

public void setOption ( $name, $value )
$name string
$value mixed
throws Github\Exception\InvalidArgumentException