Giter VIP home page Giter VIP logo

laravel-ipfs's Introduction

laravel-ipfs

Packagist Downloads Issues MIT License

The InterPlanetary File System is a peer-to-peer hypermedia protocol designed to make the web faster, safer, and more open. IPFS uses content-addressing to uniquely identify each file in a global namespace connecting all computing devices.

It is an ideal solution for a decentralized storage for blockchain-based content and is optimized for the Algorand blockchain .

Introduction

laravel-ipfs is a simple wrapper around the IPFS HTTP API with an elegant approach to connect your application to the IPFS network so you can easily host and fetch content with just a few lines of code.

Once installed, you can simply connect your application to the network and add content:

$ipfs->add(Utils::tryFopen('ipfs.png', 'r'), 'ipfs.png', ['pin' => true]);

or show IPFS object data:

$contents = $ipfs->cat('QmNZdYefySKuzF37CWjR8vZ319gYToS61r3v3sRwApXgaY');

Getting started

Installation

Note: laravel-ipfs requires PHP 7.4+

You can install the package via composer:

composer require rootsoft/laravel-ipfs

Usage

Create an new IPFSClient and pass the IP address and port of your local (or pinned) network.

$ipfs = new IPFSClient('127.0.0.1', 5001);

That's it! We can now easily add new content on a decentralized network!

Laravel ❤️

We've added special support to make the life of a Laravel developer even more easy!

Publish the ipfs.php config file using:

php artisan vendor:publish --provider="Rootsoft\IPFS\IPFSServiceProvider" --tag="config"

Open the config/ipfs.php file in your project and insert your credentials

return [
    'ipfs' => [
        'base_url' => '127.0.0.1',
        'port' => 5001,
    ],
];

Now you can use the IPFS Facade!

$fileHash = IPFS::add($collectible->get(), $fileName, ['only-hash' => true])['Hash'];

Methods

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing & Pull Requests

Feel free to send pull requests.

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

laravel-ipfs's People

Contributors

ivanzhang2 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.