faustbrian/laravel-remote-store

This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

Remote Storage Adapters for @laravel

0.1.0 2021-09-28 03:42 UTC

This package is auto-updated.

Last update: 2021-10-30 14:36:06 UTC


README

You can help the author become a full-time open-source maintainer by sponsoring him on GitHub.

Remote Storage Adapters for @laravel

PHP Latest Version

Installation

composer require faustbrian/laravel-remote-store

Usage

<?php

use Faust\RemoteStore\StoreFactory;

// Create store instance for gist.github.com
$store = StoreFactory::make("gist");

// Create file
$file = new FileDataTransferObject([
    'name' => 'hello.txt',
    'data' => 'Hello World',
]);

// Store the file
$remoteHash = $store->create($file);

// Read the file
var_dump($store->read($remoteHash));

// Update the file
$store->update($file);

// Delete the file
$store->delete($file);

Configuration

Depending on which store you wish to you use you will need to provide different configuration values.

.env

IPFS_GATEWAY=http://127.0.0.1:8080
IPFS_API=http://127.0.0.1:5001/api/v0

PINATA_KEY=
PINATA_SECRET=

INFURA_USERNAME=
INFURA_PASSWORD=

GITHUB_TOKEN=
GITHUB_USER=
GITHUB_REPO=

config/services.php

<?php

declare(strict_types=1);

return [

    // Default contents here...

    'github' => [
        'token'      => env('GITHUB_TOKEN'),
        'username'   => env('GITHUB_USER'),
        'repository' => env('GITHUB_REPO'),
    ],

    'ipfs' => [
        'gateway' => env('IPFS_GATEWAY'),
        'api'     => env('IPFS_API'),
    ],

    'infura' => [
        'username' => env('INFURA_USERNAME'),
        'password' => env('INFURA_PASSWORD'),
    ],

    'pinata' => [
        'key'    => env('PINATA_KEY'),
        'secret' => env('PINATA_SECRET'),
    ],

];

Testing

composer test

License

This is an open-sourced software licensed under the AGPL-3.0-or-later.