PHP code example of smakecloud / laravel-sodium

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

    

smakecloud / laravel-sodium example snippets


return [
    //...

    'cipher' => 'XCha-Cha20-Poly1305',

    //...
]

$encrypted = encrypt('secret');
$decrypted = decrypt($encrypted); // 'secret'

$signed = sign('secret');
$verified = verify($signed); // 'secret'

$signature = sign_detached('secret');
$verified = verify_detached($signature, 'secret'); // true