PHP code example of myhayo / branch-sdk

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

    

myhayo / branch-sdk example snippets


php artisan vendor:publish --provider="Myhayo\Branch\Providers\BranchServiceProvider"

$branch = new BranchService();
$ret_init = $branch->init($device);
// $ret_init 数组 ['uuid' => 设备uuid]   

$branch = new BranchService();
$branch->callback(request(), function (string $uuid, array $action, array $channel) {
    // TODO 处理
    $uuid 设备uuid
    $action 行为数据 ['action_type' => 行为类型, 'action_param'=> 行为参数]
    $channel 渠道信息 ['channel_id' => 渠道id, 'channel_key'=> 渠道标识, 'channel_name' => 渠道名称]
    
});