topsdk4yii Taobao Open Platform SDK for Yii

  1. Requirements
  2. Usage

Taobao Open Platform SDK for Yii


Yii 1.1 or above


  • Extract the extension in your application.extensions dir.
  • Add configuration in your component config:
    'appkey'=>'YOUR APP KEY',
    'secretKey'=>'YOUR APP SECRET KEY',
  • Then you can use the TopClient in your app like this:
$request = new ShopGetRequest();
$shop = Yii::app()->top->execute($request);

DO remember to import the request classes first.

  • To get taobao sessionKey, getAuthUrl() and getCallbackResponse() can handle it:
public function actionVerify()
    Yii::app()->user->returnUrl = $_SERVER['HTTP_REFERER'];
    Yii::app()->session['taobao_verify_uid'] = $_GET['nick'];

public function actionCallback()
    if (isset(Yii::app()->session['taobao_verify_uid'])) {
        $token = Yii::app()->top->getCallbackResponse($_GET);
        if ($token !== false) {
            if ($token['visitor_nick'] == Yii::app()->session['taobao_verify_uid']) {
                Yii::app()->session['taobao_session_key'] = $token['sessionKey'];
                Yii::app()->user->setFlash('verify_taobao_shop', '淘宝认证成功');
            } else {
                Yii::app()->user->setFlash('verify_taobao_shop', '淘宝认证失败');
  • When need to update the SDK, replace the files in with the files ./top/request/* in the Official PHP SDK.
1 0
1 follower
Yii Version: 1.1
License: BSD-2-Clause
Category: Web Service
Tags: taobao, top
Developed by: Leric
Created on: Jan 17, 2011
Last updated: 7 years ago


show all

Related Extensions