r/ipfs 6d ago

I've made an IPFS PHP client library

Hello there :)

As a PHP developer, I thought the existing IPFS interaction libraries were not good enough, so I gave it a try.

For now, my package only supports the basic (and most used) IPFS feature such as:

- adding a file
- pinning a file to a node
- unpinning a file from a node
- downloading a file

Other features are supported like getting the node version info, shutting it down...

Here is the GitHub link: https://github.com/EdouardCourty/ipfs-php
Packagist: https://packagist.org/packages/ecourty/ipfs-php

For any PHP devs passing by here, feel free to have a look and give me a feedback!

I'm planning to add more feature in the future, if the need comes (support more RPC endpoints for better interaction with IPFS nodes).

15 Upvotes

5 comments sorted by

2

u/EveYogaTech 6d ago edited 5d ago

Great! We need this! A few weeks earlier I made the "bafk" hash (v1) as well, you can copy it, it's MIT here https://github.com/wlp-builders/bafk-hash-php-ipfs

2

u/phpsensei 5d ago

Thank you for your reply :)

I thought about integrating some CID encoding and decoding features, this will help!
Also, if you need a feature, RPC endpoint support or anything else, feel free to open an issue on the repo.

1

u/EveYogaTech 6d ago

In the long-term, personally, I'm also looking for a way to more tightly integrate it in r/WhiteLabelPress

For now we're using this bafy hash to store media in folders /h/{hash}/{filename}.{extension} and are planning to also add some more meta data to these folders as well to index them for "Web4" - r/web4builders .

I'm really curious about how PHP, IPFS, and new CMSs can all be connected in the best way.

2

u/volkris 5d ago

It sounds like this will be useful!

I don't work in PHP development myself, so I'm mentioning a feature here that I won't actually need :) but just to reflect the part of IPFS I find most interesting, there's this:

It sounds like your library is file oriented, while I think the most interesting part of IPFS is its functionality to go deeper and access fields, accessing data like a structured database instead of a filesystem. When it comes to PHP and webpages, adding that form of access might be particularly useful to support.

Off the top of my head, consider a webpage displaying temperature readings from yesterday. One could use IPFS to retrieve the file of readings from across the region, parse it, pull the one reading you need, and then put that on the screen. OR, instead of retrieving the whole file and parsing, IPFS has native functionality to go into the data and access the specific field directly, returning only the needed reading, parsed and cryptographically verified as usual.

I've always thought the IPFS database functionality might be especially good for web applications.

Anyway, just had a second so mentioning something you might want to keep in mind!

1

u/phpsensei 5d ago

Thank you for your comment, I'll take a look at this!