This package is abandoned and no longer maintained. The author suggests using the blackplatinum/encryption package instead.

A security cryptography library for PHP. It can be used by different frameworks or pure PHP

v3.1.6 2020-01-25 22:03 UTC

This package is auto-updated.

Last update: 2020-11-13 16:43:01 UTC


README

A security cryptography library for PHP. It can be used by different frameworks or pure PHP

PHPGuard Console App

A command line interface designed for this library due to set a encryption key, test system etc.

Some of commands:

  • [php guard set:key]
  • [php guard fresh] Installation

Use [Composer] to install the package:

$ composer require baha2rmirzazadeh/phpguard

Examples

use PHPGuard\Crypto\Crypto;
use PHPGuard\Crypto\Key;

$cr = new Crypto("CAST5-CBC");
$cr->setKey(Key::getKey());
$c = $cr->encrypt([
        "Name"      => "Baha2r",
        "LastName"  => "Mirzazadeh",
        "Age"       => 22,
        "IsStudent" => true,
        "Courses"   => ["Math", "Ecocnomy", "Chemistry"]
]);
print $c."\n";
print_r($cr->decrypt($c));


$cr = $cr->setCipher("AES-192-CBC");
$cr->setKey(Crypto::generateKey());
$c = $cr->encrypt([
        "Name"      => "Baha2r",
        "LastName"  => "Mirzazadeh",
        "Age"       => 22,
        "IsStudent" => true,
        "Courses"   => ["Math", "Ecocnomy", "Chemistry"]
]);
print $c."\n";
print_r($cr->decrypt($c));
print_r(Crypto::supported());

Author

License

MIT