bsushil/rakuten-api

Rakuten PHP API SDK

dev-master 2015-07-30 06:00 UTC

This package is not auto-updated.

Last update: 2024-12-11 10:48:02 UTC


README

This package is another version for https://github.com/rakuten-ws/rws-php-sdk/ with support of PHP namespace. Works well with Yii2 and Laravel.

Installation:

{
    "require": {
        "bsushil/rakuten-api": "dev-master"
    }
}

For API information and the document, refer to the original (and official) library.

Usage:

        use Rakuten\Client;

        $client = new Client();
        $client->setApplicationId(apiKey);
        $client->setAffiliateId(affiliateID);

        $response = $client->execute('IchibaItemSearch', ['keyword'=>$searchKey, 'hits'=>$pageSize, 'page'=>$page]);
        $responseCode = $response->getCode();

        if($responseCode != 200)
        {
            $arReturn['message'] = $response->getMessage();
        }
        else
        {
            $data = $response->getData();
            $arData = [];
            $arData['totalRecords'] = $data['count'];
            $arData['pageCount'] = $data['pageCount'];
            $arData['data'] = $data['Items'];
            $arReturn['data'] = $arData;
        }