letochat / plugin5
您可以使用此仓库来进一步整合您的网站与LetoChat平台。
dev-main
2021-04-28 12:41 UTC
Requires
- php: >=5.6.0
- ext-curl: *
- ext-json: *
Requires (Dev)
- phpunit/phpunit: ^5
This package is auto-updated.
Last update: 2024-09-28 20:03:51 UTC
README
!!! 本仓库正在建设中 !!!
如果您的项目只支持PHP 5.6,请使用此插件。对于使用PHP 7+的项目,请使用此插件。
如果您有一个自定义的Web应用并希望集成LetoChat平台的先进功能,我们强烈建议使用此插件。这是LetoChat平台的官方连接器。
专用插件
如果您的项目基于一个已知平台,请查看是否有为其定制的插件。
如果在上表中未找到,现在让我们从基础知识开始。
入门
使用composer
composer require letochat/plugin5
不使用composer
查看/src文件夹并获取所需内容。
LetoChat小部件
如果您想生成一个包含更多访客详细信息的聊天脚本,请参阅以下示例
require "vendor/autoload.php"; $channelId = 'your-channel-id'; $channelSecret = 'your-channel-secret'; try{ $chat = (new LetoChat\Widget($channelId, $channelSecret))->infoValues([ 'name' => 'Ion Popescu', 'email' => 'ion.popescu@gmail.com', ])->customValues([ 'Client type' => 'Silver', 'Client code' => '0456785', ]); $chat->event('cart-add', [ 'id' => 1, 'name' => 'Dell Ispiron', 'image' => 'https://dell.com/image', 'quantity' => 1, 'price' => 1534, 'currency' => 'EUR', 'link' => 'https://dell.com/product-description-link', ]); echo $chat->build(); } catch ( Exception $e ){ echo 'Error generating script: ' . $e->getMessage();; }
将网站与LetoChat平台连接
require "vendor/autoload.php"; $channelId = 'your-channel-id'; $channelSecret = 'your-channel-secret'; $authSecret = 'your-auth-secret'; $api = new LetoChat\Connector($channelId, $channelSecret, $authSecret, [ 'get-order' => 'https://example.com/api/letochat/get-order', 'get-orders' => 'https://example.com/api/letochat/get-orders', 'get-user-cart' => 'https://example.com/api/letochat/get-user-cart', 'get-users-cart'=> 'https://example.com/api/letochat/get-users-cart', ]); if( $api->check() ){ echo 'Valid channel data'; } else { echo 'Error: ' . $api->getError(); } echo '<hr>'; if( $api->connect() ){ echo 'Connected'; } else { echo 'Error connecting: ' . $api->getError(); }
文档
与其他部分一样,此部分正在建设中。请从这里查看我们的文档
- 小部件文档
- 连接器文档