PHP code example of tourze / wechat-work-jssdk-bundle

1. Go to this page and download the library: Download tourze/wechat-work-jssdk-bundle 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/ */

    

tourze / wechat-work-jssdk-bundle example snippets




return [
    // ... other bundles
    WechatWorkJssdkBundle\WechatWorkJssdkBundle::class => ['all' => true],
];



use WechatWorkJssdkBundle\Procedure\GetWechatWorkJssdkConfig;

// Via JSON-RPC call
$config = $jsonRpcClient->call('GetWechatWorkJssdkConfig', [
    'corpId' => 'your-corp-id',
    'agentId' => 'your-agent-id',
    'url' => 'https://your-domain.com/current-page'
]);

// Returns:
// [
//     'corp' => [
//         'beta' => true,
//         'appId' => 'corp-id',
//         'timestamp' => 1234567890,
//         'nonceStr' => 'random-string',
//         'signature' => 'generated-signature'
//     ],
//     'agent' => [
//         'corpid' => 'corp-id',
//         'agentid' => 'agent-id',
//         'timestamp' => 1234567890,
//         'nonceStr' => 'random-string',
//         'signature' => 'generated-signature'
//     ]
// ]