A PHP class method to access the Bricklink API using cURL library.
##Usage
$BricklinkApi = new /PHPBricklinkApi/BricklinkAPI([
'tokenValue' => {TOKEN},
'tokenSecrect' => {TOKEN_SECRET},
'consumerKey' => {CONSUMER_KEY},
'consumerSecret' => {CONSUMER_SECRET}
]);
$response = $BricklinkApi->request({HTTP_METHOD}, {API_PATH}, {PARAMS})
->execute();
- PHP 5.5+
- cURL library extension
new /PHPBricklinkApi/BricklinkApi($params);
Returns
Returns a new instance of the BricklinkApi class.
Constructor Parameters $params
Passed as an associative array of keys and values. Accepted key values are:
- $endpoint: Allows you to overide the default Bricklink Api endpoint.
- $consumerKey: The consumer secret for your Bricklink API account. Value found at Bricklink API Registration Page
- $consumerSecret: The consumer secret for your Bricklink API account. Value found at Bricklink API Registration Page
- $tokenValue: The token key from your Bricklink API Access Tokens. Value found at Bricklink API Registration Page
- $tokenSecret: The token secret from your Bricklink API Access Tokens. Value found at Bricklink API Registration Page
- $isDevelopment: Allows unsecure connections for easier localhost development.
$BricklinkApi->request($httpMethod, $apiPath, $params);
Returns
Returns your BricklinkApi instance to enable chaining.
Parameters
- $httpMethod: Use the common REST methods. i.e. - GET, POST, PUT, DELETE
- $apiPath: The relative path of the api. Should include a leading
/
. - $params: A string with name value pairs. i.e. -
box=true&instructions=true
$BricklinkApi->request($httpMethod, $apiPath, $params)->execute();
Returns
Returns and instance of BricklinkApiResponse