openwse / flysystem-ipfs
Flysystem adapter for the IPFS API
v2.0.0
2021-05-12 19:31 UTC
Requires
- php: ^7.4
- league/flysystem: ^2.0
- openwse/ipfs-api: ^0.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.18
- league/flysystem-adapter-test-utilities: ^2.0
- php-parallel-lint/php-parallel-lint: ^1.3
- phpmd/phpmd: ^2.9
- phpstan/phpstan: ^0.12.83
- phpunit/phpunit: ^9.5.4
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.