hopkins/laravel-aylien-wrapper
Composer 安装命令:
composer require hopkins/laravel-aylien-wrapper
包简介
A laravel friendly wrapper around the Aylien PHP SDK
README 文档
README
Aylien is a package consisting of eight different Natural Language Processing, Information Retrieval and Machine Learning APIs that can be adapted to your processes and applications with relative ease. Admittidly this wrapper doesn't add a significant value to their extensive, well documented PHP SDK, as the primary purpose is to provide the facade Aylien:: to your Laravel 5 app.
#Installation
Require this package in your composer.json and update composer. Run/add either of the below two commands
"hopkins/laravel-aylien-wrapper": "dev-master"
or
composer require hopkins/laravel-aylien-wrapper=dev-master
After updating composer, add the ServiceProvider to the providers array in app/config/app.php
'Hopkins\LaravelAylienWrapper\Providers\AylienServiceProvider',
and the facade into your array of facades
'Aylien' => 'Hopkins\LaravelAylienWrapper\Facades\Aylien',
Run the artisan command to bring the config into your project
php artisan vendor:publish
I put my api keys in the .env file. To use this style of config you can copy the below into your config/aylien.php
return [ 'app_id' => env('API_AYLIEN_APP_ID'), 'app_key' => env('API_AYLIEN_APP_KEY') ];
#How to use
Aylien provides a number of great examples on their site, as well as terrific documentation. However I'd feel bad if I didn't at least provide one example. The example at the bottom of the readme uses the Sentiment analysis, however all of the following are available for use
Aylien::Sentiment(); Aylien::Extract(); Aylien::Classify(); Aylien::Concepts(); Aylien::Hashtags(); Aylien::Entities(); Aylien::Language(); Aylien::Related(); Aylien::Summarize(); Aylien::Microformats(); Aylien::UnsupervisedClassify();
Let's say you want to log all messages you receive from a chat/email client/contact form. You'd have a Message.php model in this case that saved to your database. By adding a public static function boot() method we can utilize Laravel's model events to make sure first we get the message into the db, and then take the time to call Aylien's API. The below example is using the Sentiment anaylisis
class Message extends BaseModel { protected $guarded = ['id']; public static function boot() { parent::boot(); Message::created(function(Message $message) { $aylienResponse = \Aylien::Sentiment(['text'=>$message->message]); $message->update([ 'polarity' => $aylienResponse->polarity, 'polarity_confidence' => $aylienResponse->polarity_confidence, 'subjectivity' => $aylienResponse->subjectivity, 'subjectivity_confidence' => $aylienResponse->subjectivity_confidence ]); }); } }
hopkins/laravel-aylien-wrapper 适用场景与选型建议
hopkins/laravel-aylien-wrapper 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 499 次下载、GitHub Stars 达 13, 最近一次更新时间为 2015 年 02 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「text」 「laravel」 「analysis」 「sentiment」 「aylien」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 hopkins/laravel-aylien-wrapper 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hopkins/laravel-aylien-wrapper 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 hopkins/laravel-aylien-wrapper 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Texy converts plain text in easy to read Texy syntax into structurally valid (X)HTML. It supports adding of images, links, nested lists, tables and has full support for CSS. Texy supports hyphenation of long words (which reflects language rules), clickable emails and URL (emails are obfuscated again
TwigStan is a static analyzer for Twig templates powered by PHPStan
Sentiment analysis library for PHP.
Database Standardization and Analysis Tool for Laravel
Common libraries used by Zimbra Api
Enforce architecture by defining modules with allowed dependencies. Detects forbidden, uncovered, missing and unused module dependencies in PHP projects.
统计信息
- 总下载量: 499
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 13
- 点击次数: 26
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-02-20