PHP code example of xiaozi / btorrent

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

    

xiaozi / btorrent example snippets




use BTorrent\Tree;

$arr = array(
	array(
		'length' => 111,
		'path' => array('dir1', 'dir2-1', 'file1.txt'),
	),
	array(
		'length' => 222,
		'path' => array('dir1', 'dir2-2', 'file2.md'),
	),
);
 
$tree = new Tree($arr);
// var_dump($tree);
echo json_encode($tree);