PHP code example of mrdebug / lara-file-encrypter

1. Go to this page and download the library: Download mrdebug/lara-file-encrypter 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/ */

    

mrdebug / lara-file-encrypter example snippets

 
LaraFileEncrypter::encryptFile(
  storage_path('app/files/secret-file.pdf'),
  'mysecurerawpassword'
);
 
LaraFileEncrypter::encryptFile(
  storage_path('app/files/secret-file.pdf'),
  'mysecurerawpassword'.$salt
);
 
public function decryptAndStreamDownloadFile(string $filePath, string $rawPassword)

public function decryptContentFile(string $filePath, string $rawPassword)

LaraFileEncrypter::decryptAndStreamDownloadFile(
  storage_path('app/files/secret-file.pdf'),
  'mysecurerawpassword'
);

LaraFileEncrypter::decryptContentFile(
  storage_path('app/files/secret-file.pdf'),
  'mysecurerawpassword'
);