PHPackages                             fliq/ipfs - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. fliq/ipfs

ActiveLibrary[API Development](/categories/api)

fliq/ipfs
=========

ipfs api library

v0.1.1(3y ago)31201MITPHP

Since Aug 2Pushed 3y agoCompare

[ Source](https://github.com/fliqnft/ipfs-php)[ Packagist](https://packagist.org/packages/fliq/ipfs)[ Docs](https://github.com/fliq/ipfs)[ RSS](/packages/fliq-ipfs/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (5)Versions (3)Used By (1)

Ipfs
====

[](#ipfs)

[![Latest Version on Packagist](https://camo.githubusercontent.com/555ddf5cfa7488b0dfc28d42432ceabedd2628f40b821f85450cbe870f744e4c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f666c69712f697066732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/fliq/ipfs)[![Total Downloads](https://camo.githubusercontent.com/88df86f2ba874568edfda6c555f18d5dab4b12050a8af34707a655cd38f452ce/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f666c69712f697066732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/fliq/ipfs)

Interact with IPFS using the [RPC api](https://docs.ipfs.tech/reference/kubo/rpc/).

Take a look at [contributing.md](contributing.md) to see a to do list.

Installation
------------

[](#installation)

Via Composer

```
composer require fliq/ipfs
```

Usage
-----

[](#usage)

To get started with IPFS visit the [IPFS documentation](https://docs.ipfs.tech/how-to/command-line-quick-start)

This package uses [Guzzle](https://github.com/guzzle/guzzle) every request is made using the `requestAsync` method, and every method on the Ipfs class returns a guzzles [PromiseInterface](https://docs.guzzlephp.org/en/stable/quickstart.html#async-requests).

There are two modes for the ipfs client 'api' and 'gateway'. Gateway is accessible publicly for read only operations and api can write.

```
use Fliq\Ipfs\Ipfs;

$ipfs = new Ipfs('localhost', '8080', 'http', 'gateway');

$data = $ipfs->cat('QmSgvgwxZGaBLqkGyWemEDqikCqU52XxsYLKtdy3vGZ8uq')->wait(); // spaceship-launch.jpg
```

To write files you must be in 'api' mode.

```
use Fliq\Ipfs\Ipfs;

$ipfs = new Ipfs('localhost', '5001', 'http', 'api');

$result = $ipfs->add('Hello, IPFS')->wait();

$cid = $result[0]['Hash']; // content identifier
```

You can add files flexibly to IPFS with support for strings, php resources and encode arrays into json, and multiple files at once all wrapped into a directory.

```
use GuzzleHttp\Psr7\Utils;

$ipfs = new Ipfs('localhost', '5001', 'http', 'api');

$file = Utils::tryFopen('path/to/file.jpeg')

$results = $ipfs->add([
    'file.jpeg' => $file,
    'meta.json' => [
        'name' => 'My file',
        'description' => 'file description',
        'properties' => [...],
    ],
], ['wrap-with-directory' => true])->wait();

$directoryCid = $results[2]['Hash'];
```

Retrieving data from IPFS. With the cat method you can get a Psr7 stream as a result, but for convenience you can use the `get()` and `json()` methods to read files also.

```
$data = $ipfs->cat('Qm...')
               ->then(fn($stream) => $stream->getContents())
               ->then(fn($str) => json_decode($str, 1))
               ->wait();

// is the same as.

$data = $ipfs->get('Qm...')
             ->then(fn($str) => json_decode($str, 1))
             ->wait();

// is the same as

$data = $ipfs->json('Qm...')->wait();
```

Because every request is async you can make multiple requests at the same time.

```
use GuzzleHttp\Promise;

$promises = [];

$promises[] = $ipfs->add('Hello, IPFS');
$promises[] = $ipfs->cat('QmSgvgwxZGaBLqkGyWemEDqikCqU52XxsYLKtdy3vGZ8uq');

$responses = Promise\Utils::unwrap($promises);
```

Lastly you can call any endpoint using the `call()` method.

```
$ipfs->call('name/resolve', ['query' => $args])->then(function(Response $response) {
    // handle response.
});
```

Methods:
--------

[](#methods)

### version()

[](#version)

Gets Kubo node information.

### add()

[](#add)

Adds files to IPFS

### cat()

[](#cat)

Reads files returns a Stream

#### get()

[](#get)

Reads files returns a string

#### json()

[](#json)

Reads files returns an array

### ls()

[](#ls)

Reads content from CID

### call()

[](#call)

Will call

Change log
----------

[](#change-log)

Please see the [changelog](changelog.md) for more information on what has changed recently.

Testing
-------

[](#testing)

You'll need a local IPFS node running to test using localhost.

```
./vendor/bin/pest
```

Contributing
------------

[](#contributing)

Please see [contributing.md](contributing.md) for details and a todolist.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Christian Pavilonis](https://github.com/ChristianPavilonis)
- [All Contributors](../../contributors)

License
-------

[](#license)

MIT. Please see the [license file](license.md) for more information.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

2

Last Release

1383d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cf7ca57075751c1182b311e5747c864dd4a4ab497073d10b51007a51cd573284?d=identicon)[ChristianPav](/maintainers/ChristianPav)

---

Top Contributors

[![ChristianPavilonis](https://avatars.githubusercontent.com/u/16183252?v=4)](https://github.com/ChristianPavilonis "ChristianPavilonis (6 commits)")

---

Tags

web3blockchaindecentralizationipfs

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/fliq-ipfs/health.svg)

```
[![Health](https://phpackages.com/badges/fliq-ipfs/health.svg)](https://phpackages.com/packages/fliq-ipfs)
```

###  Alternatives

[hardcastle/xrpl_php

PHP SDK / Client for the XRP Ledger

129.7k5](/packages/hardcastle-xrpl-php)[mocking-magician/coinbase-pro-sdk

Library for coinbase pro API calls

223.2k](/packages/mocking-magician-coinbase-pro-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
