PHP code example of meshboxfoundation / php-mbfs-api

1. Go to this page and download the library: Download meshboxfoundation/php-mbfs-api 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/ */

    

meshboxfoundation / php-mbfs-api example snippets


use MBFoundation\PhpIpfsApi\MBFS;

// connect to mbfs daemon API server
$mbfs = new MBFS("localhost", "8080", "5001"); // leaving out the arguments will default to these values


$hash = $mbfs->add("Hi, I'm Vingo! Welcome to use MBFS!");

$mbfs->cat($hash);

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

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

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

$mbfs->pinAdd($hash);