PHP code example of cedvict / secure
1. Go to this page and download the library: Download cedvict/secure 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/ */
cedvict / secure example snippets
ainer = new \Slim\Container();
// Adding logger to Slim container
$container['secure'] = function($c) {
return new Cedvict\Secure('public_key_file', 'private_key_file', 'passphrase');
};
$app = new \Slim\App($container);
$app->get('/', function ($request, $response, $args) {
// encrypt data before send
$encData = $this->secure->encrypt("This message from secure class library");
// decrypt data get
$realData = $this->secure->decrypt($request->getParam('data'));
return $response->write($encData . ' - ' . $realData);
});
$app->run();