PHP code example of foryoufeng / md5sign

1. Go to this page and download the library: Download foryoufeng/md5sign 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/ */

    

foryoufeng / md5sign example snippets


use Foryoufeng\Md5Sign\Md5Utils;

$api_key='123456';//you can get it from your database or .env file or config.php and so on
$data=[
    'user_id'=>1,
    'name'=>'wuqiang'
];
$data=Md5Utils::sign($data,$api_key);
var_dump($data); //you can see what it is look like

use Foryoufeng\Md5Sign\Md5Utils;

$sign=[
    'user_id'=>1,
    'name'=>'wuqiang',
    'timeStamp'=>1523519147,
    'sign'=>'4d02bfa8bcbcfb88f99a98e05aa75b33',
];
$flag=Md5Utils::verify($sign,$api_key);
var_dump($flag);