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.
Add the package using composer:
composer require erecht24/rechtstexte-sdk:"<2.0"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
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 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');
}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.
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 executeSee full documentation of the API handler for other service actions.
Please check out our Terms of use.
The eRecht24 Rechtstexte-API documentation can be found here.