erecht24/rechtstexte-sdk
Composer 安装命令:
composer require erecht24/rechtstexte-sdk
包简介
API client library for eRecht24 Rechtstexte-API
README 文档
README
The eRecht24 Rechtstexte-SDK allows your service/server to interact with the eRecht24 Rechtstexte-API. This package is under official supported by eRecht24.de. We would recommend using this package in order to use the eRecht24 Rechtstexte-API services.
Requirements
Installation
Add the package using composer:
composer require erecht24/rechtstexte-sdk:"<2.0"
Quickstart
Create your API key
API keys may be generated using the eRecht24 Projekt Manager. There is a key for development and testing purpose. Feel free to use it:
e81cbf18a5239377aa4972773d34cc2b81ebc672879581bce29a0a4c414bf117
Getting your developer key (or plugin key)
Please note that all plugins contacting the eRecht24 Rechtstexte-API must send a verified developer key. The developer key (or plugin key) is a unique key issued by eRecht24 to each developer to identify the different plugins communicating with the eRecht24 Rechtstexte-API. Keys are issued after you signed our terms and conditions for the API. Please contact us: api@e-recht24.de
The legal text model
The base model for three different legal text types.
You may use the wrapper class to import legal text types:
switch ($type) { case Helper::PUSH_TYPE_IMPRINT: case Helper::PUSH_TYPE_PRIVACY_POLICY: case Helper::PUSH_TYPE_PRIVACY_POLICY_SOCIAL_MEDIA: $legalTextHandler = new LegalTextHandler('YOUR_API_KEY', $type, 'YOUR-PLUGIN-KEY'); /* @var LegalText $legalText */ $legalTextDoc = $legalTextHandler->importDocument(); $legalText = $legalTextDoc->getHtmlDE(); { ... }
After getting a document object you can read the html text:
if ($imprint = $apiHandler->getImprint()) { $html = $imprint->getHtmlDE(); }
or with dynmamic language support:
if ($imprint = $apiHandler->getImprint()) { $html = $imprint->getHtml('en'); }
The client model
Registered clients may receive push notifications.
// new client data $newClient = (new Client()) ->setPushMethod('POST') ->setPushUri('https://test.de/push') ->setCms('WP') ->setCmsVersion('8.0') ->setPluginName('erecht24/rechtstexte-wp') ->setAuthorMail('test@test.de');
There is a limit of 3 clients per project.
Usage :: code example
This simple example register a new client with your project (api-key) and get an actual html version of the imprint text.
// require composer autoloader, update/extend to your needs // require_once '<path_to_project_root>/vendor/autoload.php'; use eRecht24\RechtstexteSDK\ApiHandler; use eRecht24\RechtstexteSDK\Model\Client; use eRecht24\RechtstexteSDK\Exceptions\Exception; // initialize api handler $apiHandler = new ApiHandler('YOUR-API-KEY', 'YOUR-PLUGIN-KEY'); // the new client data $newClient = (new Client()) ->setPushMethod('POST') ->setPushUri('https://test.de/push') ->setCms('WP') ->setCmsVersion('8.0') ->setPluginName('erecht24/rechtstexte-wp') ->setAuthorMail('test@test.de'); try { // create the new client $client = $apiHandler->createClient($newClient); if (!$apiHandler->isLastResponseSuccess()) { // do stuff in case of an error } if ($imprint = $apiHandler->getImprint()) { // example: get DE imprint $html = $imprint->getHtmlDE(); } } catch (Exception $e) { // as you need, log or rethrow here } // now go on with whatever service you want to execute
See full documentation of the API handler for other service actions.
Licence
Please check out our Terms of use.
Services
The eRecht24 Rechtstexte-API documentation can be found here.
erecht24/rechtstexte-sdk 适用场景与选型建议
erecht24/rechtstexte-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6.63k 次下载、GitHub Stars 达 9, 最近一次更新时间为 2022 年 01 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 erecht24/rechtstexte-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 erecht24/rechtstexte-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 6.63k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 4
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2022-01-13