PHP code example of rootsoft / laravel-ipfs

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

    

rootsoft / laravel-ipfs example snippets


$ipfs->add(Utils::tryFopen('ipfs.png', 'r'), 'ipfs.png', ['pin' => true]);

$contents = $ipfs->cat('QmNZdYefySKuzF37CWjR8vZ319gYToS61r3v3sRwApXgaY');

$ipfs = new IPFSClient('127.0.0.1', 5001);

return [
    'ipfs' => [
        'base_url' => '127.0.0.1',
        'port' => 5001,
    ],
];

$fileHash = IPFS::add($collectible->get(), $fileName, ['only-hash' => true])['Hash'];
ipfs.php

php artisan vendor:publish --provider="Rootsoft\IPFS\IPFSServiceProvider" --tag="config"
config/ipfs.php