cedvict / secure
Encrypt and Decrypt for Slim Framework 3
Installs: 259
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 1
pkg:composer/cedvict/secure
This package is auto-updated.
Last update: 2025-09-29 02:01:47 UTC
README
Based on RSA algorithm for Slim framework. Secure works well as class library (inject) for Slim framework 3 application.
Install
You can install Logger via composer.
$ composer require cedvict/secure
Requires Slim Framework 3 and PHP 5.5.0 or newer. Visit Secure repository at Packagist.
Usage
Class Library
To use Secure as class library, you can simply inject Secure instance into Slim container.
<?php require "vendor/autoload.php"; $container = 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();