PHPackages                             chenjia404/php-ipfs-api - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. chenjia404/php-ipfs-api

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

chenjia404/php-ipfs-api
=======================

A client library for the IPFS API

151PHP

Since May 12Pushed 3y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

IPFS API wrapper library in PHP
===============================

[](#ipfs-api-wrapper-library-in-php)

A client library for the IPFS API.

This is a complete from-the-ground-up rewrite of rannmann/php-ipfs-api.

---

Usage
=====

[](#usage)

Installing
----------

[](#installing)

This library requires PHP 7.3 and the curl and json extensions.

```
$ composer require chenjia404/php-ipfs-api
$ composer install
```

```
use rannmann\PhpIpfsApi\IPFS;

// connect to ipfs daemon API server
$ipfs = new IPFS("http://localhost:8080", "http://localhost:5001"); // leaving out the arguments will default to these values
```

API
---

[](#api)

#### add

[](#add)

Adds content to IPFS.

**Usage**

```
$hash = $ipfs->add("Hello world");
```

output

```
{
  "Bytes": "",
  "Hash": "",
  "Name": "",
  "Size": ""
}
```

#### addFromPath

[](#addfrompath)

Adds content to IPFS from a filename (helper method)

**Usage**

```
$hash = $ipfs->addFromPath("myFile.txt");
```

#### addFromUrl

[](#addfromurl)

Adds content ot IPFS from a web URL (helper method)

**Usage**

```
$hash = $ipfs->addFromUrl('https://mysite.com/img.png');
```

#### get

[](#get)

Retrieves the contents of a single hash.

**Usage**

```
$ipfs->get($hash);
```

#### ls

[](#ls)

Gets the node structure of a hash.

**Usage**

```
$nodes = $ipfs->ls($hash);

foreach ($nodes as $node) {
	echo $node['Hash'];
	echo $node['Size'];
	echo $node['Name'];
}
```

#### Object size

[](#object-size)

Returns object size.

**Usage**

```
$size = $ipfs->size($hash);
```

#### Pin

[](#pin)

Pin or unpin a hash.

**Usage**

```
$ipfs->pinAdd($hash);
$ipfs->pinRm($hash);
```

#### ID

[](#id)

Get information about your ipfs node.

**Usage**

```
print_r($ipfs->id());
```

License
=======

[](#license)

The MIT License (MIT)

Copyright (c) 2019 Jake Forrester Copyright (c) 2016 S3r3nity Technologies Copyright (c) 2015-2016 Vincent Cloutier

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity22

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.

### Community

Maintainers

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

---

Top Contributors

[![chenjia404](https://avatars.githubusercontent.com/u/2457958?v=4)](https://github.com/chenjia404 "chenjia404 (2 commits)")

### Embed Badge

![Health badge](/badges/chenjia404-php-ipfs-api/health.svg)

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

PHPackages © 2026

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