https://github.com/attla/pincryp
🧛 A layer of encryption a little too judicious
https://github.com/attla/pincryp
encription encrypt encryption laravel laravel-package
Last synced: 19 days ago
JSON representation
🧛 A layer of encryption a little too judicious
- Host: GitHub
- URL: https://github.com/attla/pincryp
- Owner: attla
- License: mit
- Created: 2022-07-12T05:51:55.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-02T15:44:41.000Z (5 months ago)
- Last Synced: 2025-04-03T06:41:51.155Z (2 months ago)
- Topics: encription, encrypt, encryption, laravel, laravel-package
- Language: PHP
- Homepage:
- Size: 50.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pincryp
## Installation
```bash
composer require attla/pincryp
```Publish resources:
```bash
php artisan vendor:publish --provider="Attla\Pincryp\PincrypServiceProvider"
```## Usage
```php
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:
```php
// 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](LICENSE) © [Zunq](https://zunq.com).