attla / pincryp
A layer of encryption a little too judicious.
dev-main
2024-11-21 21:01 UTC
Requires
- php: >=7.2.5
- attla/support: dev-main
- tuupola/base58: ^2.1
Requires (Dev)
- orchestra/testbench: ^7.19
- pestphp/pest: ^1.22
- pestphp/pest-plugin-global-assertions: ^1.0
- phpbench/phpbench: ^1.2
This package is auto-updated.
Last update: 2024-11-21 21:01:24 UTC
README
Installation
composer require attla/pincryp
Publish resources:
php artisan vendor:publish --provider="Attla\Pincryp\PincrypServiceProvider"
Usage
use Attla\Pincryp\Config; use Attla\Pincryp\Factory as Pincryp; // create config instance $config = new Config(); $config->key = 'hic sunt dracones'; // or $config = new Config(['key' => 'hic sunt dracones']); // creating Pincryp instance $pincryp = new Pincryp($config); // encoding $encoded = $pincryp->encode('this is something to encode..'); echo 'encoded: ' . $encoded.PHP_EOL; $decoded = $pincryp->decode($encoded); echo 'decoded: ' . $decoded.PHP_EOL;
The Pincryp can encrypt all primitive types: array
, stdClass
, object
, string
, integer
, float
, bool
, and null
.
See an example of array encryption:
// encoding $encoded = $pincryp->encode([ 'name' => 'John Doe', 'email' => 'john@example.com' ]); echo 'encoded: ' . $encoded.PHP_EOL; // to return a stdClass pass the second param as TRUE $decoded = $pincryp->decode($encoded, false); echo 'decoded: ' . $decoded.PHP_EOL;
Config params
License
This package is licensed under the MIT license © Zunq.