https://github.com/minchao/shopee-php
Shopee OpenAPI 1.0 Client for PHP
https://github.com/minchao/shopee-php
shopee shopee-client shopee-partner-api shopee-php
Last synced: 6 months ago
JSON representation
Shopee OpenAPI 1.0 Client for PHP
- Host: GitHub
- URL: https://github.com/minchao/shopee-php
- Owner: minchao
- License: bsd-3-clause
- Created: 2018-02-04T08:21:14.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-08-19T07:34:11.000Z (about 1 year ago)
- Last Synced: 2025-04-04T05:08:01.798Z (6 months ago)
- Topics: shopee, shopee-client, shopee-partner-api, shopee-php
- Language: PHP
- Homepage:
- Size: 95.7 KB
- Stars: 141
- Watchers: 12
- Forks: 84
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# shopee-php
[](https://github.com/minchao/shopee-php/actions?query=workflow%3Atests)
[](https://packagist.org/packages/minchao/shopee-php)
[](https://packagist.org/packages/minchao/shopee-php)
[](https://packagist.org/packages/minchao/shopee-php)This is a [Shopee OpenAPI 1.0](https://open.shopee.com/documents/v1/Introduction?module=63&type=2) Client for PHP.
⚠️ [The Shopee Open API v.1.0 will be completely deprecated after 26 December 2022](https://open.shopee.com/developer-guide/22).
## Requirements
* PHP >= 7.1
* [Composer](https://getcomposer.org/download/)
* [Guzzle](https://guzzle.readthedocs.io/en/latest/overview.html#requirements)## Installation
Execute the following command to get the package:
```console
$ composer require minchao/shopee-php
```## Usage
Create an instance of the Shopee client, then use to access the Shopee Partner API.
```php
getenv('SHOPEE_PARTNER_KEY'),
'partner_id' => getenv('SHOPEE_PARTNER_ID'),
'shopid' => getenv('SHOPEE_SHOP_ID'),
]);
```## Examples
### Get detail of item
```php
$response = $client->item->getItemDetail(['item_id' => 1978]);
```Alternatively, you can also use the parameter model within request.
```php
$parameters = (new \Shopee\Nodes\Item\Parameters\GetItemDetail())
->setItemId(1978);
$response = $client->item->getItemDetail($parameters);
```### Webhook
Use webhook to receive incoming push notifications:
```php
post('/webhook', function (Request $request, Response $response) use ($signatureValidator) {
// Verify push content
if (!$signatureValidator->isValid($request)) {
error_log('Invalid authorization signature');
return $response;
}// TODO here to handle your business logic
// HTTP response must with status code 2xx and empty body
return $response;
});$app->run();
```## License
See the [LICENSE](LICENSE) file for license rights and limitations (BSD 3-Clause).