1. Go to this page and download the library: Download veribenim/php-sdk 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/ */
veribenim / php-sdk example snippets
use Veribenim\VeribenimClient;
// SDK'yı başlat
$client = new VeribenimClient(
token: 'your_api_token',
domain: 'example.com', // Bundle script URL için (example.com → examplecom.js)
lang: 'tr',
debug: false
);
// Form rızası kaydet
$client->logFormConsent(
formName: 'contact',
consented: true,
consentText: 'KVKK şartlarını kabul ettim',
metadata: ['email' => '[email protected]']
);
// Veri sahibi erişim isteği
$client->submitDsar(
requestType: 'access',
fullName: 'John Doe',
email: '[email protected]'
);
// app/Providers/AppServiceProvider.php
public function register()
{
$this->app->singleton(VeribenimClient::class, function () {
return new VeribenimClient(
token: config('veribenim.token'),
domain: config('veribenim.domain'),
lang: config('veribenim.lang'),
debug: config('app.debug')
);
});
}
// wp-content/plugins/veribenim-consent/veribenim-consent.php
$veribenim = new VeribenimClient(
token: get_option('veribenim_token'),
lang: 'tr'
);
// Hook'lar ile entegre edin
add_action('wp_footer', function() use ($veribenim) {
$veribenim->logImpression();
});
use Veribenim\VeribenimClient;
$client = new VeribenimClient('TOKEN_HERE');
// Tüm metodlar:
$client->logFormConsent(...); // Form rızası
$client->getPreferences(...); // Tercih al
$client->savePreferences(...); // Tercih kaydet
$client->logImpression(); // Sayfa ziyareti
$client->logConsent(...); // Manuel rıza
$client->withdrawConsent(...); // Rızayı geri çek (KVKK Md.11/1-e)
$client->submitDsar(...); // DSAR isteği
$client->getFormSchema(...); // Form şeması (çoklu dil)
$client->submitForm(...); // Form gönderimi
$client->renderFormHtml(...); // Sunucu tarafı form render
$client->collectAnalytics(...); // Web analytics hit
$client->trackEvent(...); // Özel olay (tracked event) tetikleme
$client->getVendors(); // IAB TCF v2.2 vendor listesi
$client->scanCookies(...); // Çerez/tracker taraması
$client->verifyDomain(...); // Domain doğrulama
$client->scriptTag(); // Banner script tag'i
$client->impressionPixelUrl(...); // 1x1 pixel fallback URL
try {
$client->logFormConsent(
formName: 'newsletter_signup',
consented: true,
consentText: 'Haber bültenine abone olmak için kişisel verilerinizin işlenmesine rıza veriyorum.',
metadata: [
'email' => '[email protected]',
'source' => 'homepage',
'language' => $_SERVER['HTTP_ACCEPT_LANGUAGE'] ?? 'tr'
]
);
// İşlem başarılı
$response = json_encode(['status' => 'success']);
} catch (Exception $e) {
// Hata yönetimi
error_log('Veribenim error: ' . $e->getMessage());
}
$client->savePreferences([
'necessary' => true, // Her zaman true
'analytics' => true,
'marketing' => false,
'preferences' => true
]);
// AJAX ile
header('Content-Type: application/json');
echo json_encode(['status' => 'saved']);
// Her sayfada çalıştır
$client->logImpression();
// Veya Analytics entegrasyonu
if ($client->getPreferences()['analytics']) {
$client->logImpression();
}