Skip to content

Commit

Permalink
初始化提交
Browse files Browse the repository at this point in the history
  • Loading branch information
easelify committed Jul 21, 2020
0 parents commit cd0c651
Show file tree
Hide file tree
Showing 30 changed files with 2,337 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.DS_Store
.php_cs.cache
/.idea
/vendor/
/tests/config.php
26 changes: 26 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Copyright (c) 2015-2016, Cloudflare. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
小鹅通云服务PHPSDK
================

## 通过Composer安装

```
composer require easelify/xiaoet
```

## 使用范例

```php
use xiaoet\Client;
use xiaoet\request\AccessTokenRequest;
use xiaoet\request\UserInfoGetRequest;

// 创建 Client 对象
$config = [
'app_id' => 'your app id',
'client_id' => 'your client id',
'app_secret' => 'your app secret',
];
$client = new Client($config);

// 获取 access token
$req = new AccessTokenRequest();
$req->setAppId($config['app_id']);
$req->setClientId($config['client_id']);
$req->setSecretKey($config['app_secret']);
$rs = $client->execute($req);

$accessToken = '';
if ($rs['code'] == 0) {
// 可储存$accessToken到数据库或文件备用
$accessToken = $rs['data']['access_token'];
} else {
throw new \Exception('Access Token 获取失败');
}

// 获取用户信息
$req = new UserInfoGetRequest();
$req->setUserId('u_5ec2a39b6857a_vG4siBRLLy');
$rs = $client->execute($req, $accessToken);
print_r($rs);
```

更多范例详见 ./tests 目录

## Licensing

Licensed under the 3-clause BSD license. See the [LICENSE](LICENSE) file for details.
27 changes: 27 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "easelify/xiaoet",
"description": "小鹅通云服务PHPSDK",
"type": "library",
"license": "BSD-3-Clause",
"authors": [
{
"name": "easelify",
"email": "[email protected]"
}
],
"require": {
"php": ">=7.0.0",
"guzzlehttp/guzzle": "^7.0"
},
"autoload": {
"psr-4": {
"xiaoet\\": "src/"
}
},
"repositories": {
"packagist": {
"type": "composer",
"url": "https://mirrors.aliyun.com/composer/"
}
}
}
Loading

0 comments on commit cd0c651

Please sign in to comment.