live-person-inc/live-engage-laravel
Composer 安装命令:
composer require live-person-inc/live-engage-laravel
包简介
LiveEngage package for laravel
README 文档
README
Laravel package to easily tap the LiveEngage developer APIs for such content as Engagement History, Engagement Attributes, and more...
Use at your own risk. This package carries no SLA or support and is still currently under development.
Installation
Install via composer
composer require live-person-inc/live-engage-laravel
Register Service Provider
Note! This and next step are optional if you use laravel>=5.5 with package auto discovery feature.
Add service provider to config/app.php in providers section
LivePersonInc\LiveEngageLaravel\ServiceProvider::class,
Register Facade
Register package facade in config/app.php in aliases section
'LiveEngage' => LivePersonInc\LiveEngageLaravel\Facades\LiveEngageLaravel::class,
Usage
Create/Obtain an API key from LiveEngage with appropriate permissions for the APIs you intend to access. The default key is required.
Configure your keys/account in config/services.php
'liveperson' => [ 'default' => [ 'key' => 'xxxxxxx', 'secret' => 'xxxxxxx', 'token' => 'xxxxxxx', 'token_secret' => 'xxxxxxx', 'account' => '123456', ] ],
If you want to have multiple API keys, you can add more arrays for them. The keys for each array are arbitrary, but you will need to specify them later to access specific key sets.
'liveperson' => [ 'default' => [ 'key' => 'xxxxxxx', 'secret' => 'xxxxxxx', 'token' => 'xxxxxxx', 'token_secret' => 'xxxxxxx', 'account' => '123456', ], 'history' => [ 'key' => 'xxxxxxx', 'secret' => 'xxxxxxx', 'token' => 'xxxxxxx', 'token_secret' => 'xxxxxxx', 'account' => '123456', ], 'attributes' => [ 'key' => 'xxxxxxx', 'secret' => 'xxxxxxx', 'token' => 'xxxxxxx', 'token_secret' => 'xxxxxxx', 'account' => '123456', ] ],
To make an api call on a specific key set...
$history = LiveEngage::key('history')->engagementHistory(); //conversationHistory() for messaging
To use the default keyset, you need not use the key method at all.
$history = LiveEngage::engagementHistory(); //conversationHistory() for messaging
Example: Capturing engagement history between 2 date/times using global account configured above.
use LiveEngage; use Carbon\Carbon;
$start = new Carbon('2018-06-01 08:00:00'); $end = new Carbon('2018-06-03 17:00:00'); /** * engagementHistory function. * * @access public * @param Carbon $start (default: null) * @param Carbon $end (default: null) * @param mixed $skills (default: []) */ $history = LiveEngage::engagementHistory($start, $end);
Example: Getting engagement history between 2 date/times for specific skill IDs.
use LiveEngage; use Carbon\Carbon;
$start = new Carbon('2018-06-01 08:00:00'); $end = new Carbon('2018-06-03 17:00:00'); $skills = [432,676]; $history = LiveEngage::engagementHistory($start, $end, $skills);
engagementHistory() and conversationHistory() returns a Laravel collection of Engagement objects.
Example: Pulling the next "page" of data in to the collection.
$history->next(); // one page
Or
while ($next = $history->next()) { $history = history->merge($next) } // get all remaining data
Example: Iterate through all messages of the transcript
$engagement = $history->find('3498290084'); // This is a collection, so random(), first(), last() all work as well foreach ($engagement->transcript as $message) { // For messaging conversations, use messageRecords instead of transcript echo $message . "\n"; // calling the message object as a string returns its text value }
Transcript is a collection of message objects, so you can access properties of the message as well.
echo $message->time->format('Y-m-d'); //The all time properties are Carbon date objects.
$conversation = LiveEngage::conversationHistory()->first(); foreach ($conversation->transfers as $transfer) { echo $transfer->targetSkillName . "\n"; }
Example: Get messaging agents availability by skill
$availableAgents = LiveEngage::getAgentStatus(17); //Skill ID 17 $online = $availableAgents->state('online'); $away = $availableAgents->state('away');
Security
If you discover any security related issues, please email rlester@liveperson.com instead of using the issue tracker.
Credits
This package is bootstrapped with the help of melihovv/laravel-package-generator.
live-person-inc/live-engage-laravel 适用场景与选型建议
live-person-inc/live-engage-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 954 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 06 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「live」 「engage」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 live-person-inc/live-engage-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 live-person-inc/live-engage-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 live-person-inc/live-engage-laravel 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
aliyunsdk
Laravel package for the simplification and integration of many of your users most wanted login providers. Installation is a breeze. Never worry about OAuth again.
Magento 2 Social Login extension is designed for quick login to your Magento 2 store without procesing complex register steps
Janrain API client
Automatic Live Update Client
Alfabank REST API integration
统计信息
- 总下载量: 954
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-06-11