PHP code example of artisanpack-ui / compliance
1. Go to this page and download the library: Download artisanpack-ui/compliance 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/ */
artisanpack-ui / compliance example snippets
use ArtisanPackUI\Compliance\Compliance\Consent\ConsentManager;
$manager = app( ConsentManager::class );
$record = $manager->grant( $user->id, 'analytics', [
'collection_method' => 'banner',
'ip_address' => request()->ip(),
'user_agent' => request()->userAgent(),
] );
Route::post( '/track', [TrackingController::class, 'store'] )
->middleware( 'check.consent:analytics' );
use ArtisanPackUI\Compliance\Models\ErasureRequest;
use ArtisanPackUI\Compliance\Compliance\Erasure\ErasureService;
use Illuminate\Support\Str;
$request = ErasureRequest::create( [
'request_number' => 'ER-' . (string) Str::ulid(),
'user_id' => $user->id,
'requester_type' => 'self',
'scope' => 'full',
'deadline_at' => now()->addDays( 30 ),
] );
app( ErasureService::class )->process( $request );
'features' => [
'compliance.privacy_policy_draft' => [ 'enabled' => true ],
'compliance.dpia_assistance' => [ 'enabled' => true ],
'compliance.consent_text' => [ 'enabled' => true ],
],
bash
php artisan migrate
bash
php artisan vendor:publish --tag=compliance-config
blade
<livewire:ap-compliance-ai-tools />
<button
wire:click="$dispatch('compliance-ai:suggest-consent-text', {
payload: {
purpose: 'Send weekly product update emails',
data_categories: ['email address', 'engagement metrics'],
audience: 'general public',
jurisdiction: 'EU',
}
})"
>Suggest consent text</button>