devkind/rytr-php
Composer 安装命令:
composer require devkind/rytr-php
包简介
README 文档
README
RytrPhp is a simple SDK implementation of Rytr API. It helps accessing the API in an object oriented way.
Oficial Rytr-me page: https://rytr.me/
Oficial Rytr-me git documentation: https://github.com/rytr-me/documentation
Getting the API key
please register an account and request an api key at Rytr.
Please check out the tutorials section for more information
Installation
You can install the package via composer:
composer require devkind/rytr-php
Usage
Initialization:
use Devkind\RytrPhp; /** @var \Devkind\RytrPhp */ $rytr = new RytrPhp(API_KEY);
alternatively we can initialize static
/** @var \Devkind\RytrPhp */ $rytr = \Devkind\RytrPhp::make(API_KEY);
Objects / Endpoints:
Endpoints are basically the type of content that is supported by Rytr.
Each endpoint requireds an $tone and $language parameter to query from rytr.
Defaults
protected $language = '607adac76f8fe5000c1e636d'; //english
language="🇺🇸 English" - language in which the texts will be generated - change using setLangugage()
protected $language = '607adac76f8fe5000c1e636d'; //english
tone="Casual" - tones in which the text will be - change using setTone()
protected int $variations = 1;
variations = 1 - number of texts in response - change using setVariation()
protected string $format = 'text';
formats='html' - html or text - ** change using setFormat()**
protected string $creativityLevel = 'default';
creativity_level='default' - fault | none | low | medium | high | max - change using setCreativityLevel()
user_id='USER1' - "For userId you need to supply user ID from your database, eg: primary key for users database table." - change using setUserId()
in order to change the language or tone we can call the setter methods, which is available on all the endpoints.
to set the language
/** @var \Devkind\RytrPhp\Endpoints\Usercases\BrandName */ $endpoint = $rytr->BrandName->setLanguage('english');
to set the tone
/** @var \Devkind\RytrPhp\Endpoints\Usercases\BrandName */ $endpoint = $rytr->BrandName->setTone('candid');
alternatively:
/** @var \Devkind\RytrPhp\Endpoints\Usercases\BrandName */ $endpoint = $rytr->BrandName->setTone('candid')->setLanguage('english')->setVariation(10);
All the endpoints can be called into three different ways
through the get method
/** @var \Devkind\RytrPhp\Endpoints\UseCases\BrandName */ $endpoint = $object->BrandName; $endpoint = $endpoint->get(['brandDescription' => "google"]);
through the setter methods
/** @var \Devkind\RytrPhp\Endpoints\UseCases\BrandName */ $endpoint = $object->BrandName; $endpoint = $endpoint ->setBrandDescription("google") ->setVariations(10) ->setUserId(100) ->setFormat('html') ->setCreativityLevel('medium') ->get();
through the generate method
/** @var \Devkind\RytrPhp\Endpoints\UseCases\BrandName */ $endpoint = $object->BrandName; $endpoint = $endpoint->generate("google");
Supported Objects / Endpoints:
Click here to view the entire documentation of supported endpoints
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email backend@devkind.com.au instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
devkind/rytr-php 适用场景与选型建议
devkind/rytr-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 15 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 11 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「devkind」 「rytr-php」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 devkind/rytr-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 devkind/rytr-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 devkind/rytr-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PSR-7 compatible library for making CRUD API endpoints
A lightweight plain-PHP framework for database-backed CRUD APIs.
Modern, strongly-typed, PSR-compliant PHP client for the WeFact v2 API.
PHP SDK for the Enconvert file conversion API
统计信息
- 总下载量: 15
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-11-12