1. Go to this page and download the library: Download kuga/openapi-core library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kuga / openapi-core example snippets
namespace Kuga\Api\Test;
use Kuga\Core\Api\AbstractApi;
class TestApi extends AbstractApi{
public function create(){
//获得业务参数对象
$data = $this->_toParamObject($this->getParams());
$dataArray = $data->toArray();
//accessToken或JWT解密后得到了用户ID
$currentUserId = $this->_userMemberId;
return [
'list'=>[],
'userId'=>$currentUserId,
'total'=>10
];
}
}