danielcrt / pinata-laravel by i.daniel

The Laravel provider for Pinata API.
806
0
1
Package Data
Maintainer Username: i.daniel
Package Create Date: 2021-12-23
Package Last Update: 2022-11-01
Language: PHP
License: MIT
Last Refreshed: 2024-04-22 03:02:02
Package Statistics
Total Downloads: 806
Monthly Downloads: 2
Daily Downloads: 0
Total Stars: 0
Total Watchers: 1
Total Forks: 1
Total Open Issues: 0

Laravel Pinata API Provider

This is a Laravel/Lumen provider for interacting with Pinata API.

Install

Require this package with composer using the following command:

composer require danielcrt/pinata-laravel

Installation

Add your API credentials to pinata array in the config/services.php config file as follows:

return [

    ...

    'pinata' => [

        'api_key' => env('PINATA_API_KEY'),
        'secret_key' => env('PINATA_API_SECRET')
    ]
]

Laravel

Add the service provider to the providers array in the config/app.php config file as follows:

'providers' => [

    ...

    \Pinata\Providers\PinataServiceProvider::class,
]

Lumen

Add the following snippet to the bootstrap/app.php file under the providers section as follows:


$app->configure('services');
$app->register(Pinata\Providers\PinataServiceProvider::class);

Usage

Pin a File to IPFS

  use Pinata\Facades\Pinata;

  $file_path = '';

  $response = Pinata::pinFileToIPFS($file_path);

Pin a JSON to IPFS

  use Pinata\Facades\Pinata;

  $json = [];

  $response = Pinata::pinJSONToIPFS($json);

Unpin

  use Pinata\Facades\Pinata;

  $ipfs_hash = '';

  $response = Pinata::removePinFromIPFS($ipfs_hash);

For more details about request parameters and responses please visit the official documentation: https://docs.pinata.cloud

Available methods

  • addHashToPinQueue

  • pinFileToIPFS

  • pinHashToIPFS

  • pinJobs

  • pinJSONToIPFS

  • removePinFromIPFS

  • userPinnedDataTotal

  • userPinList