looptribe/paytoshi-library-php

This package is abandoned and no longer maintained. No replacement package was suggested.

PHP Library for Paytoshi's API.

v1.0 2016-01-11 16:03 UTC

This package is not auto-updated.

Last update: 2023-10-10 14:40:18 UTC


README

Build Status Coverage Status Packagist

PHP Library for Paytoshi's API.

Requirements

  • PHP >= 5.3
  • PHP cURL extension (recommended) OR
  • allow_fopen_url enabled in your PHP config.

Installation

The recommended way to install Paytoshi PHP Library is through composer.

composer.phar require looptribe/paytoshi-library-php

Usage

Paytoshi PHP Library uses the Buzz library.

Create the API wrapper object

Using FileGetContents

<?php

$browser = new \Buzz\Browser();
$paytoshi = new \Looptribe\Paytoshi\Api\PaytoshiApi($browser, 'http://paytoshi.org/api/v1/');

Using cUrl

<?php

$browser = new \Buzz\Browser(new \Buzz\Client\Curl());
$paytoshi = new Looptribe\Paytoshi\Api\PaytoshiApi($browser, 'http://paytoshi.org/api/v1/');

Setup the client

If you wish you can set a timeout on the requests (default 5 seconds):

<?php

// Set 10 seconds of timeout
$browser->getClient()->setTimeout(10);

Faucet API

Create a new faucet payout

<?php
// Create the $paytoshi object as explained in the previous section
...

// Create a new payout
$result = $paytoshi->send(
    'a8p9uevhfgx7ewt1kf09v2n3kfhzkeyxi8ywcehfqnl9is30gq', //Faucet Api key
    '1EhNaUFaVW99in6drLeD8ygrLicAcf8rAc', //Bitcoin address
    100, //Amount
    '127.0.0.1' //Recipient ip
);

// Create a referral payout
$result = $paytoshi->send(
    'a8p9uevhfgx7ewt1kf09v2n3kfhzkeyxi8ywcehfqnl9is30gq',  //Faucet Api key
    '18aWoXRJRTfK8ZdxH9Y8qW3Q3AKPqra2DlyO',  //Bitcoin address
    100, //Amount
    '127.0.0.1', //Recipient ip
    true //Referral flag
);

Check balance

// Check balance
$result = $paytoshi->getBalance(
    'a8p9uevhfgx7ewt1kf09v2n3kfhzkeyxi8ywcehfqnl9is30gq'  //Faucet Api key
);

// Your balance in satoshi
$balance = $result->getAvailableBalance();

License

Paytoshi PHP Library is BSD licensed.