{"id":14956224,"url":"https://github.com/digitalkaoz/php-ipfs-api","last_synced_at":"2025-10-01T17:31:07.172Z","repository":{"id":56993095,"uuid":"79380351","full_name":"digitalkaoz/php-ipfs-api","owner":"digitalkaoz","description":"php client library for ipfs","archived":false,"fork":false,"pushed_at":"2018-12-24T23:03:56.000Z","size":116,"stargazers_count":50,"open_issues_count":2,"forks_count":7,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-01-14T12:00:41.406Z","etag":null,"topics":["ipfs","ipfs-daemon","php"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/digitalkaoz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-18T20:19:43.000Z","updated_at":"2024-11-25T08:38:48.000Z","dependencies_parsed_at":"2022-08-21T10:40:41.139Z","dependency_job_id":null,"html_url":"https://github.com/digitalkaoz/php-ipfs-api","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalkaoz%2Fphp-ipfs-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalkaoz%2Fphp-ipfs-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalkaoz%2Fphp-ipfs-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalkaoz%2Fphp-ipfs-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/digitalkaoz","download_url":"https://codeload.github.com/digitalkaoz/php-ipfs-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234720450,"owners_count":18876611,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ipfs","ipfs-daemon","php"],"created_at":"2024-09-24T13:12:33.876Z","updated_at":"2025-10-01T17:31:06.819Z","avatar_url":"https://github.com/digitalkaoz.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP Adapter for IPFS\n\n![ipfs](https://user-images.githubusercontent.com/1211152/29604883-ca3a4028-87e0-11e7-9f9a-75de49b06048.png)\n\nDont know what ipfs is? the future of filesystems :) read [here](https://ipfs.io) for more information!\n\n[![Build Status](https://travis-ci.org/digitalkaoz/php-ipfs-api.svg?branch=master)](https://travis-ci.org/digitalkaoz/php-ipfs-api)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/digitalkaoz/php-ipfs-api/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/digitalkaoz/php-ipfs-api/?branch=master)\n[![Code Coverage](https://scrutinizer-ci.com/g/digitalkaoz/php-ipfs-api/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/digitalkaoz/php-ipfs-api/?branch=master)\n\n## Installation\n\nas always, use composer!\n```\n$ composer require ipfs/php-client\n```\n\n### choosing the HTTP Adapter\n\nIf you plan to use the REST Interface of the ipfs-daemon you should choose a http-implementation. We use [php-http](http://docs.php-http.org/) for abstraction.\n\nSee [here](https://packagist.org/providers/php-http/async-client-implementation) for a list of available implementations!\n\nif you only want to speak with a local ipfs-daemon you should use the `IPFS\\\\Drivers\\\\Cli` adapter.\n\n### Annotations\n\nas we use Annotations you should register the `AnnotationLoader`\n\n```php\n$loader = require __DIR__.'/../vendor/autoload.php';\n\nuse Doctrine\\Common\\Annotations\\AnnotationRegistry;\n\nAnnotationRegistry::registerLoader(array($loader, \"loadClass\"));\n```\n\n## Drivers\n\nwe ship with different adapters for communicating with the daemon.\n\n### CLI\n\nif you are using an `ipfs` binary that is not available in you `$PATH` variable, provide an `ENV` var for it:\n\n```\n$ export IPFS_BINARY=/my/location/to/ipfs\n```\n\n\u003e make sure you set `IPFS_PATH` in you `ENV` if you are not using `~/.ipfs` as location.\n\nto use this Driver from the commandline simply provide the option:\n\n```\n$ bin/php-ipfs version --driver=IPFS\\\\Driver\\\\Cli\n```\n\n### HTTP\n\nif you are talking to a remote daemon  provide an `ENV` var for it:\n\n```\n$ export IPFS_API=http://somehost:5001/api/v0\n```\n\nto use this Driver from the commandline simply provide the option (or leave it away since its the default):\n\n```\n$ bin/php-ipfs version --driver=IPFS\\\\Driver\\\\Http\n$ bin/php-ipfs version\n```\n\n### Client\n\nthis Driver is intended for programmatically usage:\n\n```php\n$driver = $container[IPFS\\Driver\\Cli::class];\n//$driver = $container[IPFS\\Driver\\Http::class];\n$client = new IPFS\\Client($driver);\n\n$response = $client-\u003eexecute((new \\IPFS\\Api\\Basics())-\u003eversion());\n\nvar_dump($response);\n```\n\n## Apis\n\nAll Api-Endpoints are autogenerated from the official [ipfs docs](https://ipfs.io/docs/api/) and are regulary checked for changes.\n\n\u003e To rebuild the Apis yourself, simply run `composer rebuild-api`\n\nThe following endpoints exists:\n\n```\nAvailable commands:\n  add                       Add a file or directory to ipfs.\n  cat                       Show IPFS object data.\n  commands                  List all available commands.\n  dns                       Resolve DNS links.\n  get                       Download IPFS objects.\n  help                      Displays help for a command\n  id                        Show ipfs node id info.\n  list                      Lists commands\n  ls                        List directory contents for Unix filesystem objects.\n  mount                     Mounts IPFS to the filesystem (read-only).\n  ping                      Send echo request packets to IPFS hosts.\n  rebuild                   rebuild api classes by parsing the official api doc\n  resolve                   Resolve the value of names to IPFS.\n  shutdown                  Shut down the ipfs daemon.\n  update\n  version                   Show ipfs version information.\n bitswap\n  bitswap:ledger            Show the current ledger for a peer.\n  bitswap:reprovide         Trigger reprovider.\n  bitswap:stat              Show some diagnostic information on the bitswap agent.\n  bitswap:unwant            Remove a given block from your wantlist.\n  bitswap:wantlist          Show blocks currently on the wantlist.\n block\n  block:get                 Get a raw IPFS block.\n  block:put                 Store input as an IPFS block.\n  block:rm                  Remove IPFS block(s).\n  block:stat                Print information of a raw IPFS block.\n bootstrap\n  bootstrap:add:default     Add default peers to the bootstrap list.\n  bootstrap:list            Show peers in the bootstrap list.\n  bootstrap:rm:all          Remove all peers from the bootstrap list.\n config\n  config:edit               Open the config file for editing in $EDITOR.\n  config:profile:apply      Apply profile to config.\n  config:replace            Replace the config with .\n  config:show               Output config file contents.\n dag\n  dag:get                   Get a dag node from ipfs.\n  dag:put                   Add a dag node to ipfs.\n  dag:resolve               Resolve ipld block.\n dht\n  dht:findpeer              Query the DHT for all of the multiaddresses associated with a Peer ID.\n  dht:findprovs             Find peers in the DHT that can provide a specific value, given a key.\n  dht:get                   Given a key, query the DHT for its best value.\n  dht:provide               Announce to the network that you are providing given values.\n  dht:put                   Write a key/value pair to the DHT.\n  dht:query                 Find the closest Peer IDs to a given Peer ID by querying the DHT.\n diag\n  diag:cmds:clear           Clear inactive requests from the log.\n  diag:cmds:set-time        Set how long to keep inactive requests in the log.\n  diag:sys                  Print system diagnostic information.\n file\n  file:ls                   List directory contents for Unix filesystem objects.\n files\n  files:chcid               Change the cid version or hash function of the root node of a given path.\n  files:cp                  Copy files into mfs.\n  files:flush               Flush a given path’s data to disk.\n  files:ls                  List directories in the local mutable namespace.\n  files:mkdir               Make directories.\n  files:mv                  Move files.\n  files:read                Read a file in a given mfs.\n  files:rm                  Remove a file.\n  files:stat                Display file status.\n  files:write               Write to a mutable file in a given filesystem.\n filestore\n  filestore:dups            List blocks that are both in the filestore and standard block storage.\n  filestore:ls              List objects in filestore.\n  filestore:verify          Verify objects in filestore.\n key\n  key:gen                   Create a new keypair.\n  key:list                  List all local keypairs.\n  key:rename                Rename a keypair.\n  key:rm                    Remove a keypair.\n log\n  log:level                 Change the logging level.\n  log:ls                    List the logging subsystems.\n  log:tail                  Read the event log.\n name\n  name:publish              Publish IPNS names.\n  name:pubsub:cancel        Cancel a name subscription.\n  name:pubsub:state         Query the state of IPNS pubsub.\n  name:pubsub:subs          Show current name subscriptions.\n  name:resolve              Resolve IPNS names.\n object\n  object:data               Output the raw bytes of an IPFS object.\n  object:diff               Display the diff between two ipfs objects.\n  object:get                Get and serialize the DAG node named by .\n  object:links              Output the links pointed to by the specified object.\n  object:new                Create a new object from an ipfs template.\n  object:patch:add-link     Add a link to a given object.\n  object:patch:append-data  Append data to the data segment of a dag node.\n  object:patch:rm-link      Remove a link from an object.\n  object:patch:set-data     Set the data field of an IPFS object.\n  object:put                Store input as a DAG object, print its key.\n  object:stat               Get stats for the DAG node named by .\n p2p\n  p2p:listener:close        Close active p2p listener.\n  p2p:listener:ls           List active p2p listeners.\n  p2p:listener:open         Forward p2p connections to a network multiaddr.\n  p2p:stream:close          Close active p2p stream.\n  p2p:stream:dial           Dial to a p2p listener.\n  p2p:stream:ls             List active p2p streams.\n pin\n  pin:add                   Pin objects to local storage.\n  pin:ls                    List objects pinned to local storage.\n  pin:rm                    Remove pinned objects from local storage.\n  pin:update                Update a recursive pin.\n  pin:verify                Verify that recursive pins are complete.\n pubsub\n  pubsub:ls                 List subscribed topics by name.\n  pubsub:peers              List peers we are currently pubsubbing with.\n  pubsub:pub                Publish a message to a given pubsub topic.\n  pubsub:sub                Subscribe to messages on a given topic.\n refs\n  refs:local                List all local references.\n repo\n  repo:fsck                 Remove repo lockfiles.\n  repo:gc                   Perform a garbage collection sweep on the repo.\n  repo:stat                 Get stats for the currently used repo.\n  repo:verify               Verify all blocks in repo are not corrupted.\n  repo:version              Show the repo version.\n stats\n  stats:bitswap             Show some diagnostic information on the bitswap agent.\n  stats:bw                  Print ipfs bandwidth information.\n  stats:repo                Get stats for the currently used repo.\n swarm\n  swarm:addrs:listen        List interface listening addresses.\n  swarm:addrs:local         List local addresses.\n  swarm:connect             Open connection to a given address.\n  swarm:disconnect          Close connection to a given address.\n  swarm:filters:add         Add an address filter.\n  swarm:filters:rm          Remove an address filter.\n  swarm:peers               List peers with open connections.\n tar\n  tar:add                   Import a tar file into ipfs.\n  tar:cat                   Export a tar file from IPFS.\n```\n\n## Usage\n\nsimply use the commandline interface\n\n```\n$ bin/php-ipfs\n$ bin/php-ipfs add ./composer.lock --wrap-with-directory --driver=IPFS\\\\Driver\\\\Cli\n$ bin/php-ipfs add ./composer.lock --wrap-with-directory\n\n```\n\n## PHAR\n\nto build a `phar` file simply run\n\n\u003e we assume you have https://box-project.github.io/box2/ installed!\n\n```\n$ composer build\n```\n\n## Tests\n\nthis library is well covered with [phpspec](http://www.phpspec.net/)\n\n```\n$ composer test\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalkaoz%2Fphp-ipfs-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdigitalkaoz%2Fphp-ipfs-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalkaoz%2Fphp-ipfs-api/lists"}