定制 ecourty/ipfs-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ecourty/ipfs-php

最新稳定版本:1.4.0

Composer 安装命令:

composer require ecourty/ipfs-php

包简介

A lightweight IPFS interaction library for PHP

README 文档

README

PHP CI

IPFS-PHP provides a simple way to interact with an IPFS Node using PHP.
The changelog for this project can be found here.

Installation

composer require ecourty/ipfs-php

Usage

The following example shows how to add a file to IPFS and retrieve its content later.

<?php

use IPFS\Client\IPFSClient;

// Three different ways to instantiate the client
$client = new IPFSClient(url: 'http://localhost:5001');

// If nothing is passed, the default values are used (localhost and 5001)
// $client = new IPFSClient();
// $client = new IPFSClient(host: 'localhost', port: 5001);

// Add a file
$file = $client->addFile('file.txt');

echo 'File uploaded: ' . $file->hash;
// File uploaded: QmWGeRAEgtsHW3ec7U4qW2CyVy7eA2mFRVbk1nb24jFyks
// ...

// Get the file content
$fileContent = $client->cat($file->hash);
// ...

// Downloads the complete file
$file = $client->get($file->hash);
// ...

// Download the file as a tar archive (compression can be specified with the compression parameters)
$archive = $client->get($file->hash, archive: true);
file_put_contents('archive.tar', $archive);
// ...

More code examples can be found under the examples directory.

© Edouard Courty 2025

统计信息

  • 总下载量: 756
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-03-12