PHP code example of phonetworks / ipfs-php

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

    

phonetworks / ipfs-php example snippets



use IPFSPHP\IPFS;

127.0.0.1', 8080, 5001);




$hash = $ipfs->add($filePath);

$ipfs->cat($hash);

$obj = $ipfs->ls($hash);

foreach ($obj as $e) {
	echo $e['Hash'];
	echo $e['Size'];
	echo $e['Name'];
}

$size = $ipfs->size($hash);

$ipfs->pinAdd($hash);
bash
 composer