nebulaprotocol / ipfs-php
IPFS library in PHP
1.0.0
2018-08-26 15:34 UTC
Requires
- php: >=7.1
- ext-curl: *
- guzzlehttp/guzzle: ^6.3.0
This package is not auto-updated.
Last update: 2025-03-05 07:49:03 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