In composer.json
:
{
"require": {
"rmrevin/yii2-xxtea": "1.2.0"
}
}
/protected/config/main.php
<?
return array(
// ...
'components' => array(
// ...
'xxtea' => array(
'class' => 'rmrevin\yii\xxtea\Component',
'key' => 'qwertyuiopasdfgh', // 16 letters
'base64_encode' => true,
),
),
// ...
);
<?
// ...
$XXTEA = \Yii::$app->get('xxtea');
$hash = $XXTEA->encrypt('data to encrypting');
$data = $XXTEA->decrypt($hash);
Comments