mettle/big-huge-thesaurus-client
Composer 安装命令:
composer require mettle/big-huge-thesaurus-client
包简介
PHP Client around Big Huge Thesaurus API
README 文档
README
PHP Wrapper for the Big Huge Labs Thesaurus API.
Install
Via Composer
$ composer require mettle/big-huge-thesaurus-client
Usage
$API_KEY = 'Get an api key @ https://words.bighugelabs.com/api.php'; $client = new Mettleworks\BigHugeThesaurusClient\BigHugeThesaurusClient($API_KEY); $response = $client->lookup('love');
The response object is an instance of ThesaurusResponse, an object that wraps the original response and adds a few convenience methods. You can optionally pass an argument to each method to indicate if you want only nouns (noun), verbs (verb), adjectives (adjective) or adverbs (adverb) otherwise they will return all results combined. The signature of the methods is the following:
/** * Get the synonyms from the response */ $response->getSynonyms($type = null): array /** * Get the antonyms from the response */ $response->getAntonyms($type = null): array /** * Get the similar terms from the response */ $response->getSimilarTerms($type = null): array /** * Get related terms from the response */ $response->getRelatedTerms($type = null): array /** * Cast response to array (returns the original response) */ $response->toArray(): array /** * Cast response to JSON */ $response->toJson()
The client throws specific exceptions when an error occurs. Those errors are documented on the Big Huge Thesaurus Api Page.
try { $response = $client->lookup('love'); } catch (NotFoundException $ex) { // Not Found } catch (UsageExceededException $ex) { // Usage exceeded } catch (InactiveKeyException $ex) { // Key not active } catch (MissingWordsException $ex) { // No words provided } catch (NotWhitelistedException $ex) { // IP address blocked }
Additionally if an error occurs outside the listed ones, the original Guzzle Exception is thrown.
Testing
$ composer test
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email maurizio@mettle.io instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
mettle/big-huge-thesaurus-client 适用场景与选型建议
mettle/big-huge-thesaurus-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 657 次下载、GitHub Stars 达 6, 最近一次更新时间为 2021 年 01 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「big-huge-thesaurus-client」 「big huge thesaurus」 「mettle」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mettle/big-huge-thesaurus-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mettle/big-huge-thesaurus-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mettle/big-huge-thesaurus-client 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Safe number conversion between arbitrary bases.
JSON streaming reader (memory safety parser) with chunking option
Easy PHP XLSX Writer that is support cell styling, merged cells, multiple worksheets, images, line chart, bar chart and pie chart, huge rows and rows/columns fixing
Large Array Writer (sample: sitemap writer)
Huge php JSON reader
PHP Client around Big Huge Thesaurus API
统计信息
- 总下载量: 657
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-01-21