https://github.com/abtswath/psn-client
PSN 游戏列表、奖杯进度、奖杯列表接口
https://github.com/abtswath/psn-client
api playstation playstation-api ps-api ps4 ps5 psn
Last synced: 5 months ago
JSON representation
PSN 游戏列表、奖杯进度、奖杯列表接口
- Host: GitHub
- URL: https://github.com/abtswath/psn-client
- Owner: abtswath
- Created: 2022-09-08T12:08:31.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-09-08T12:24:10.000Z (almost 4 years ago)
- Last Synced: 2024-11-20T05:29:15.205Z (over 1 year ago)
- Topics: api, playstation, playstation-api, ps-api, ps4, ps5, psn
- Language: PHP
- Homepage:
- Size: 16.6 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PSN API 库
## 安装
```shell
composer require abtswath/psn-client
```
## 使用
### 登录
1. 登录 [PlayStation](https://www.playstation.com/)
2. 到[这个页面](https://ca.account.sony.com/api/v1/ssocookie)获取 NPSSO token 并复制。
3. 使用 NOSSO token 换取 oauth token
```injectablephp
use Abtswath\PSNClient\Client;
$npsso = '上一步获取的 NPSSO';
$client = new Client();
$authToken = $client->auth()->login($npsso);
$accessToken = $authToken->getAccessToken();
$client->setAccessToken($accessToken);
```
### API
```injectablephp
$client->user()->gameList(); // 获取用户游戏列表
$client->user()->trophyTitles(); // 获取用户奖杯列表
$client->trophy()->trophies(); // 获取某个游戏奖杯列表
$client->trophy()->earned(); // 获取某个游戏已解锁的奖杯
```
## 参考
本工具库的实现参考了 [https://andshrew.github.io/PlayStation-Trophies](https://andshrew.github.io/PlayStation-Trophies) 与 [https://github.com/Tustin/psn-php](https://github.com/Tustin/psn-php),具体的接口返回示例与请求参数说明请参考以上文档。