Download the PHP package goldfinch/trademe-php-api without Composer
On this page you can find all versions of the php package goldfinch/trademe-php-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package trademe-php-api
Original repo
Trade Me PHP API
An unofficial PHP client to make it easy to interface with Trade Me's API platform.
Installation
composer require goldfinch/trademe-php-api
Authorizing
Getting temporary access tokens (Step 1)
$config = [
'sandbox' => true,
'oauth' => [
'consumer_key' => 'foo',
'consumer_secret' => 'bar',
],
];
$client = new \JPCaparas\TradeMeAPI\Client($config);
['oauth_token' => $tempAccessToken, 'oauth_token_secret' => $tempAccessTokenSecret] = $client->getTemporaryAccessTokens();
Getting the OAuth token verifier to validate temporary access tokens (Step 2)
$tokenVerifierUrl = $client->getAccessTokenVerifierURL($tempOAuthToken); // Visit this URL and store the verifier code
Getting the final access tokens (Step 3)
// The config values are a culmination of steps 1 and 2
$config = [
'temp_token' => 'baz',
'temp_token_secret' => 'qux',
'token_verifier' => 'quux'
];
['oauth_token' => $accessToken, 'oauth_token_secret' => $accessTokenSecret] = $client->getFinalAccessTokens($config);
Making API calls
You can make API calls once you've gotten your final access tokens:
Selling an item
$config = [
'sandbox' => true,
'oauth' => [
'consumer_key' => 'foo',
'consumer_secret' => 'bar',
'token' => 'baz',
'token_secret' => 'qux',
'token_verifier' => 'quu',
],
];
$client = new Client($config);
$params = [
'Category' => 'TestCategory',
'Title' => 'TestTitle',
'Description' => ['TestDescriptionLine1'],
'Duration' => 1,
'BuyNowPrice' => 99,
'StartPrice' => 90,
'PaymentMethods' => [2, 4],
'Pickup' => 1,
'ShippingOptions' => [
['Type' => 1],
],
];
$client->sellItem($params);
Tests
vendor/bin/phpunit
References
All versions of trademe-php-api with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.1
ext-curl Version *
ext-json Version *
guzzlehttp/guzzle Version ^7.8
guzzlehttp/oauth-subscriber Version ^0.6.0
ext-curl Version *
ext-json Version *
guzzlehttp/guzzle Version ^7.8
guzzlehttp/oauth-subscriber Version ^0.6.0
The package goldfinch/trademe-php-api contains the following files
Loading the files please wait ....