承接 erecht24/rechtstexte-sdk 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

PHP 7.1 or better

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.

统计信息

  • 总下载量: 6.63k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 0
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2022-01-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固