PHP code example of lombokclarion / security

1. Go to this page and download the library: Download lombokclarion/security 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/ */

    

lombokclarion / security example snippets


LombokClarion\Security

// Password hashing
$hasher = new Argon2idPasswordHasher();
$hash = $hasher->hash('secret');
$hasher->verify('secret', $hash); // true

// Encryption
$encrypter = new AesGcmEncrypter($appKey);
$cipher = $encrypter->encrypt('sensitive data');
$plain = $encrypter->decrypt($cipher);

// CSRF (in routes)
$router->post('/form', [Controller::class, 'submit'], [
    ValidateCsrf::class,
]);

// Rate limiting
$router->post('/login', [AuthController::class, 'login'], [
    RateLimit::perMinute(5, $rateLimitStore),
]);