PHP code example of safecomms / safecomms-php
1. Go to this page and download the library: Download safecomms/safecomms-php library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
safecomms / safecomms-php example snippets
eComms\SafeCommsClient;
$client = new SafeCommsClient('your-api-key');
try {
// Moderate text
$result = $client->moderateText(
content: 'Some text to check',
language: 'en',
replace: false,
pii: false,
replaceSeverity: null,
moderationProfileId: 'prof_123'
);
print_r($result);
// Get usage
$usage = $client->getUsage();
print_r($usage);
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
bash
composer