PHP code example of aichadigital / lara-privacy-core

1. Go to this page and download the library: Download aichadigital/lara-privacy-core 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/ */

    

aichadigital / lara-privacy-core example snippets


use AichaDigital\LaraPrivacyCore\Contracts\LegallyRetainable;
use AichaDigital\LaraPrivacyCore\CheckLegalHold;
use DateTimeImmutable;
use DateTimeInterface;

final class AccountingDocument implements LegallyRetainable
{
    public function __construct(
        private readonly ?DateTimeImmutable $fiscalYearEnd, // null = not booked
        private readonly int $years,
    ) {}

    public function retainedUntil(): ?DateTimeInterface
    {
        return $this->fiscalYearEnd?->modify("+{$this->years} years");
    }
}

$held = (new CheckLegalHold)->isUnderRetention($document, new DateTimeImmutable);