PHP code example of ipfs / php-client

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

    

ipfs / php-client example snippets


$loader = rine\Common\Annotations\AnnotationRegistry;

AnnotationRegistry::registerLoader(array($loader, "loadClass"));

$driver = $container[IPFS\Driver\Cli::class];
//$driver = $container[IPFS\Driver\Http::class];
$client = new IPFS\Client($driver);

$response = $client->execute((new \IPFS\Api\Basics())->version());

var_dump($response);

$ composer 

$ bin/php-ipfs
$ bin/php-ipfs add ./composer.lock --wrap-with-directory --driver=IPFS\\Driver\\Cli
$ bin/php-ipfs add ./composer.lock --wrap-with-directory