openwse/flysystem-ipfs

Flysystem adapter for the IPFS API

v2.0.0 2021-05-12 19:31 UTC

This package is auto-updated.

Last update: 2024-04-18 21:29:37 UTC


README

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.