nebulaprotocol/ipfs-php

IPFS library in PHP

1.0.0 2018-08-26 15:34 UTC

This package is not auto-updated.

Last update: 2024-05-01 03:29:05 UTC


README

Install:

 composer require nebulaprotocol/ipfs-php

Examples:

use IPFSPHP\IPFS;

include 'vendor/autoload.php';

$ipfs = new IPFS('127.0.0.1', 8080, 5001);

API

add

Adds content to IPFS.

Usage

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

cat

Retrieves the contents of a single hash.

Usage

$ipfs->cat($hash);

ls

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'];
}

Object size

Returns object size.

Usage

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

Pin

Pins a hash.

Usage

$ipfs->pinAdd($hash);

CREDITS

Initially forked from https://github.com/cloutier/php-ipfs-api