This package, becklyn/ddd-gdpr-bundle, is a Laravel-compatible bundle for integrating GDPR compliance into Domain-Driven Design (DDD) applications. After upgrading to v2.0.0, developers should focus on:
becklyn/ddd-symfony-bridge) are updated to v3.0.0+ (since the bridge is no longer compatible with v2.0).composer require becklyn/ddd-gdpr-bundle:^2.0
Then publish the bundle’s config (if needed) and bind GDPR-related services in config/app.php or a service provider.GDPR Compliance Layer:
GdprService to handle data subject requests (DSRs) like data deletion, export, or rectification.$gdprService = app()->make(GdprService::class);
$gdprService->deletePersonalData($userId, $dataController);
GdprDataDeleted).Symfony 7 Integration:
#[Route('/gdpr/delete', name: 'gdpr_delete')]
public function handleDataDeletion(Request $request): Response
{
$gdprService->deletePersonalData($request->get('user_id'));
return new Response('Data deleted per GDPR');
}
Laravel-Specific Patterns:
GdprAwareTrait to auto-apply GDPR rules:
use Becklyn\GdprBundle\Traits\GdprAwareTrait;
class User extends Model
{
use GdprAwareTrait;
}
class GdprPolicy
{
public function canDeleteData(User $user): bool
{
return $user->hasRole('admin');
}
}
$this->app->bind(GdprService::class, function ($app) {
return new GdprService(
$app->make(DataSubjectRepository::class),
$app->make(LoggerInterface::class)
);
});
php artisan vendor:publish --provider="Becklyn\GdprBundle\GdprBundle"
Symfony Bridge Drop:
becklyn/ddd-symfony-bridge:2.0. If your project uses this bridge, upgrade to v3.0.0+ or migrate to native Laravel/Symfony 7 integration.Laravel-Specific Quirks:
GdprDataExported) are properly subscribed in Laravel’s EventServiceProvider. Symfony’s event system may not auto-discover Laravel events.$router->middleware('gdpr.middleware')->group(function () {
// GDPR routes
});
Logging:
'gdpr' => [
'debug' => env('APP_DEBUG', false),
],
Testing:
GdprService in PHPUnit tests:
$mockGdpr = $this->createMock(GdprService::class);
$mockGdpr->method('deletePersonalData')->willReturn(true);
$this->app->instance(GdprService::class, $mockGdpr);
Custom Data Controllers:
AbstractDataController to add project-specific GDPR logic:
class CustomDataController extends AbstractDataController
{
protected function getAdditionalDataToDelete(): array
{
return ['audit_logs'];
}
}
Symfony 7 Features:
Attribute system to annotate GDPR-related methods:
#[GdprProtected]
public function sensitiveOperation(): void
{
// ...
}
Laravel Policies:
Gate::define('delete-gdpr-data', function (User $user, $model) {
return $user->can('gdpr-delete', $model);
});
How can I help you explore Laravel packages today?