/flysystem-ipfs

Flysystem adapter for the IPFS API

Primary LanguagePHPMIT LicenseMIT

Flysystem v2 adapter for the IPFS API

This package contains a Flysystem v2 adapter for IPFS. Under the hood, the IPFS API PHP wrapper is used.


Installation

You can install the package via composer:

composer require openwse/flysystem-ipfs

Usage

use League\Flysystem\Filesystem;
use Ipfs\Ipfs;
use Ipfs\Drivers\HttpClient;
use FlysystemIpfs\IpfsAdapter;

$client = new Ipfs(
    new HttpClient('https://ipfs-host', 5001)
);

$adapter = new IpfsAdapter($client);

$filesystem = new Filesystem($adapter);

Note: that removing a file on IPFS will only affect your node if the file has been pinned.

Lint

Run PHPMD, PHPStan, and PHP-CS-Fixer

composer lint

Testing

It uses tests cases provided by Flysystem but override visibility & last modified settings because it's not supported by IPFS.

composer tests

License

The MIT License (MIT). Please see License File for more information.