Download the PHP package fmujie/tuling without Composer
On this page you can find all versions of the php package fmujie/tuling. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download fmujie/tuling
More information about fmujie/tuling
Files in fmujie/tuling
Download fmujie/tuling
More information about fmujie/tuling
Files in fmujie/tuling
Please rate this library. Is it a good library?
Informations about the package tuling
现仅有图灵Api
的文本交互功能
安装
- 安装包文件
配置
-
注册
ServiceProvider
: -
创建配置文件:
通常得需要选择
publish
哪一个服务,因为没带参数,选择编号 [n ][n ] Provider: Fmujie\TulingApi\TulingApiServiceProvider
执行命令后会在
config
目录下生成本扩展配置文件:laravel-tuling-apikey.php
。 -
在
.env
文件中增加如下配置:TULING_API_KEY
:图灵ApiKey
。
使用
-
文本交流
接口字段:
参数 类型 说明 可为空 text String 合成的文本 N userId String 用户唯一标识 N city String 所在城市 N province String 所在省份 Y street String 所在路段 Y 接口返回字段详细见 图灵API V2.0接入文档.
调用示例
<?php namespace App\Http\Controllers\Api; use Illuminate\Http\Request; use Fmujie\TulingApi\TulingApi; use App\Http\Controllers\Controller; class TestController extends Controller { public function test(Request $request) { $res = TulingApi::txtConversation($request, '我爱你'); return response()->json([ 'result' => $this->return ], $this->statusCode); } }
返回示例
{ "result": { "code": 1, "status": "success", "msg": "请求成功", "data": "我也喜欢你啦~" } }
注:使用
txt
优先级大于Request
License
The MIT License (MIT). Please see License File for more information.
All versions of tuling with dependencies
PHP Build Version
Package Version
Requires
guzzlehttp/guzzle Version
^6.3
The package fmujie/tuling contains the following files
Loading the files please wait ....