composer require nebulaprotocol/ipfs-php
use IPFSPHP\IPFS;
include 'vendor/autoload.php';
$ipfs = new IPFS('127.0.0.1', 8080, 5001);
Adds content to IPFS.
Usage
$hash = $ipfs->add($filePath);
Retrieves the contents of a single hash.
Usage
$ipfs->cat($hash);
Gets the node structure of a hash.
Usage
$obj = $ipfs->ls($hash);
foreach ($obj as $e) {
echo $e['Hash'];
echo $e['Size'];
echo $e['Name'];
}
Returns object size.
Usage
$size = $ipfs->size($hash);
Pins a hash.
Usage
$ipfs->pinAdd($hash);
Initially forked from https://github.com/cloutier/php-ipfs-api