<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
assistenzde / simple-cryptographic-bundle example snippets
$cryptographicService = new SimpleCryptographicService('$ecr3t');
$encryptedString1 = $cryptographicService->encrypt('Hello world!'); // some encrypted string, i.e. 'ABCDEFG'
echo $cryptographicService->decrypt($encryptedString1); // outputs 'Hello world!'
$encryptedString2 = $cryptographicService->encrypt('Hello world!'); // some encrypted string, i.e. 'HIJKLMNOP'
echo $cryptographicService->decrypt($encryptedString2); // outputs 'Hello world!'
namespace MyNamespace;
use Assistenzde\SimpleCryptographicBundle\Service\SimpleCryptographicService;
/**
* Class AuthenticationSubscriber
*/
final class MyClass
{
/**
* the crypto service to encode/dedoce strings
*
* @var SimpleCryptographicService
*/
protected SimpleCryptographicService $simpleCryptographicService;
/**
* MyClass constructor
*
* @param SimpleCryptographicService $simpleCryptographicService
*/
public function __construct(SimpleCryptographicService $simpleCryptographicService)
{
$this->simpleCryptographicService = $simpleCryptographicService;
}
/**
*
*/
public function doSomething()
{
// do some calculation and get a user token
// encrypt the user token
$encryptedUserToken = $this->simpleCryptographicService->encrypt($userToken);
// and do some more stuff,
// esp. use the encrypted token (i.e. as request parameter or to save in a file)
// derypt the encrypted stuff
$userToken = $this->simpleCryptographicService->decrypt($encryptedUserToken);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.