kydev / tencent-wj-client
腾讯问卷客户端
v0.2.0
2022-03-05 06:28 UTC
Requires
- php: >=8.0
- guzzlehttp/guzzle: ^7.4
- hyperf/utils: ^2.2|^3.0
- jetbrains/phpstorm-attributes: ^1.0
- pimple/pimple: ^3.5
- psr/simple-cache: ^1.0|^2.0|^3.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- hyperf/config: ^2.2|^3.0
- hyperf/di: ^2.2|^3.0
- mockery/mockery: ^1.0
- phpstan/phpstan: ^1.0
- phpunit/phpunit: >=7.0
- swoole/ide-helper: ^4.5
- vlucas/phpdotenv: ^5.4
Suggests
- swow/swow: Required to create swow components.
README
composer require kydev/tencent-wj-client
使用
具体使用方法请查看 腾讯问卷文档
快速开始
Hyperf
框架中,可以直接使用 KY\Tencent\WJClient
。
- 发布配置
php bin/hyperf.php vendor:publish kydev/tencent-wj-client
- 注入并使用
<?php use KY\Tencent\WJClient\Factory; use Hyperf\Di\Annotation\Inject; class IndexController { #[Inject] public Factory $factory; public function index() { return $this->factory->get('default')->user->info('1'); } }
其他框架,可以自行 new Application()
使用。
<?php use KY\Tencent\WJClient\Application; $app = new Application([ 'app_id' => 'xxx', 'app_secret' => 'xxx', 'http' => [ 'base_uri' => 'https://open.wj.qq.com/', 'http_errors' => false, 'timeout' => 2, ], ]); $result = $app->user->info('1');