LaravelPackages.net
Acme Inc.
Toggle sidebar
attla/pincryp

A layer of encryption a little too judicious.

263
0
About attla/pincryp

attla/pincryp is a Laravel package for a layer of encryption a little too judicious.. It currently has 0 GitHub stars and 263 downloads on Packagist. Install it with composer require attla/pincryp. Discover more Laravel packages by attla or browse all Laravel packages to compare alternatives.

Last updated

Pincryp

License Latest Stable Version Total Downloads

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' => '[email protected]'
]);
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

| Parameter | Type | Description | |--|--|--| | key | String | Encryption secret key | | entropy | Integer | Entropy length to generate unique results, set zero for always the same results | | seed | String, Integer, Null | Alphabet base seed to create a unique dictionary |

License

This package is licensed under the MIT license © Zunq.

Comments