1. Go to this page and download the library: Download exinone/mixin-sdk-php 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/ */
exinone / mixin-sdk-php example snippets
// config format
$config0 = [
"app_id" => "d4155247-xxxx-xxxx-aa8a-775333b12406",
"session_id" => "7a633a3f-xxxx-xxxx-99b9-ae43c88be4be",
"server_public_key" => "556b82842exxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxa6d8ad8af3f2649474",
"session_private_key" => "154cd8dceaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx24d070b1acc880a13b",
"spend_key" => "f86d9dd3faxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxc64e8bc7c5aef6a0a4",
"client_secret" => "fdbe66249axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcc4519a4ea20d48b7e"
];
// old format is also supported
$config1 = [
'mixin_id' => '7000101633',
'client_id' => '982afd4e-92dd-4430-98cf-d308442ea04d',
'client_secret' => 'b0a9adf1b358501b1fb6065c6292b09dbc675d5734225f86e0ec14a71d0fd38a',
'pin' => '125334',
'pin_token' => 'RzgyepFhLbMx+zLw6ogYzZ5k+kmlo8gQ2f4+1uwGMi1HgvMexGdFdeny0ffuBl7gXgPqi1GpUDPWPNrgAIjwGIFu+rHSre1G7JA5ET6tgIYoC+OI2dF0PmNK0qtkjK+qpGpSCt8nFbTfgyHjFENAp4hLZEIhuhzSPPmkkhXGlAU=',
'session_id' => '8a70b414-bdef-46f3-9738-186c1095da61',
'private_key' => <<<EOF
-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQCZAkpYA7eH38GbzIX653dxBAEanrSSdYbzQYIV/kKbULYSB43X
5hWfCFpNJ6FoIUjHAzrNyqJMvSS6LwAA+R4w5GYv8en1Ga1blKbziCMvZsRJ65bP
F2cPbPQUYNWZpZRsyFlMZCjVVytA1a+HWba5FzGBXiEEzd5BVo9truxGKQIDAQAB
AoGBAJHpVj4ipUWEgtvxKR9A1m1G9UqOaAJ2409cfBI/GwOD72y4GXL2rk2vKHYF
Qe3MN9vY353aC/YENV77bRSAfGF+lAuw3hQOFfMvKfRUmVaB5V4kEaF1+z9jPHwh
QcSpqyAsMClEnyMxbNrFih4tQGlGUydHI3xv1wK+53MjncwBAkEA98GvzldsLW7E
dhwXLba3KN/GvLZLcljLyHjctUxCU8EywD73UM1lJuayWvYdLfzFe0p9cDjvS8Gx
sbYg3eE2qQJBAJ4ZkqVbdCAyUBpjaIO9QzxsL77zCgayrQTvWv0QQgJputO7S2rs
i/iCmt1bZ3IAnfVnDUJfAaxSL6VU1T6Fw4ECQQCtUvrCx7YOMqeOWSh9+o04MxS9
gGpXnHcz0BnXW3orTcVLaMFr7cUN6eZsbDENswAUuI/4qlv+C4tcX6Wuk5fBAkA+
EggzB37GDTrJwXGNF0dId6kfLMgo7QlkwJxWcoWX8O66pfPsHMavYIdwlKw+Y+Og
Lz9TaX18rB+sp2u5SkcBAkBIsC/AJNhf1xILLAkkpycJ7rc864Y1JbmKk+I5fXid
vA4vKPqu2ZnD0O4YbGmciuTRPgeJqAt8bbHq/xOfL0lE
-----END RSA PRIVATE KEY-----
EOF
, //import your private_key
];
$mixinSdk = new \ExinOne\MixinSDK\MixinSDK();
// use setConfig method to save config
$mixinSdk->setConfig('myConfig-A',$config0);
$mixinSdk->setConfig('myConfig-B',$config1);
// then you can
$mixinSdk->use('myConfig-A')->user()->readProfile();
//-------
// Or more simple way, using the 'use' method , chained with other methods
$mixinSdk->use('myConfig-A',$config)->user()->readProfile();
// then you can
$mixinSdk->use('myConfig-A')->user()->readProfile();
try {
// If the transfer fails here, an error will be thrown.
$mixinSdk->wallet()->transfer($asset_id, $opponent_id, $pin, $amount, $memo);
} catch (MixinNetworkRequestException $e) {
// Here errCode and errMessage are the same as MixinNetwork, refer to the following link.
$errCode = $e->getCode();
$errMessage = $e->getMessage();
...
} catch (\Throwable $e) {
...
}
$iterator = [time()];
// if use it by $mixinSdk->pin()->updatePin($oldPin,$pin),
// $iterator need have two element (count($iterator) == 2)
$mixinSdk->wallet()->setIterator($iterator)->transfer($asset_id, $opponent_id, $pin, $amount, $memo);
// By default, ( microtime(true) . RANDOM NUMBERS ) * 1000000000 is used as iterator
$mixinSdk->wallet()->setTimeout(10)->transfer($asset_id, $opponent_id, $pin, $amount, $memo);
// The default timeout is 20 s