turbolabit / php-encryptor
A single, zero-config service with encrypt() and decrypt() methods to safely share or expose confidential data
Package info
github.com/TurboLabIt/php-encryptor
Type:symfony-bundle
pkg:composer/turbolabit/php-encryptor
dev-main
2024-09-12 13:17 UTC
Requires
- php: ^8.2
- ext-openssl: *
Requires (Dev)
- phpunit/phpunit: @stable
- symfony/framework-bundle: @stable
This package is auto-updated.
Last update: 2026-03-12 16:46:13 UTC
README
A single, zero-config service with encrypt() and decrypt() methods to safely share or expose confidential data
๐ฆ 1. Install it with composer
symfony composer require turbolabit/php-encryptor:dev-main
๐ 2. Symfony usage
<?php use TurboLabIt\Encryptor\Encryptor; class Property { protected string $bookingToken = '12345678'; public function __construct(protected Encryptor $encryptor) {} public function getBookingData() : string { $arrData = [ "name" => 'aabbcc', "bookingToken" => $this->bookingToken; ] return $this->encryptor->encrypt($arrData); } public function decodeBookingData(string $text) : array { return $this->encryptor->decrypt($text); } }
See: Usage
3. โ๏ธ Symfony custom configuration (optional)
# config/services.yaml TurboLabIt\Encryptor\Encryptor: arguments: $secretKey: '%env(APP_SECRET)%'
See: services.yaml
๐งช Test it
git clone git@github.com:TurboLabIt/php-encryptor.git
cd php-encryptor
bash script/symfony-bundle-tester.sh