PHP code example of janjanenjoy / crypt

1. Go to this page and download the library: Download janjanenjoy/crypt library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

janjanenjoy / crypt example snippets


//config/app.php


'providers' => [
        //...
        JanjanEnjoy\Crypt\CryptServiceProvider::class,    //This is default in laravel 5.5
    ],

/**if you want to use Facade mode ,you can add your own alias configuration like below.**/
'aliases' => [
        //...
        'MyCrypt' => \JanjanEnjoy\Crypt\CryptService::class,
]

//bootstrap/app.php

$app->register( JanjanEnjoy\Crypt\CryptServiceProvider::class);


    /**
     * 本项目的app_secret
     */
    'app_secret' =>env('XTHK_APP_SECRET','12345678912345678912345678912312'),

    /**
     * 加密规则,支持AES-128-CBC,AES-256-CBC
     */
    'cipher' => env('XTHK_CIPHER','AES-256-CBC'),

$data = ['test'=>123];
$sign = MingCrypt::sign($data);   //签名
print_r($sign);
$check = MingCrypt::signCheck($data,$sign);   //验签
print_r($check);

shell script
php artisan vendor:publish --provider=JanjanEnjoy\\Crypt\\CryptServiceProvider