2017 © Pedro Peláez
 

symfony-bundle changelly-bundle

A Symfony Bundle for Changelly APIs

image

paneedesign/changelly-bundle

A Symfony Bundle for Changelly APIs

  • Friday, May 4, 2018
  • by pane-e-design
  • Repository
  • 4 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Changelly for Symfony

A Symfony Bundle for Changelly APIs, (*1)

Install

composer require paneedesign/changelly-bundle

Usage

Enable the bundle

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            // ...

            new PaneeDesign\ChangellyBundle\PedChangellyBundle(),
        ];

        // ...
    }

    // ...
}

Create client

$changelly = $this->get('ped_changelly.handler');

Call APIs

getCurrencies

Description: + Returns a list of enabled currencies as a flat array., (*2)

$changelly->getCurrencies();

result:, (*3)

[
  "btc",
  "eth",
  "etc",
  "exp",
  "xem",
  "lsk",
  "xmr",
  "strat",
  "rep",
  "lbc",
  "maid",
  "ltc",
  "bcn",
  "xrp",
  "doge",
  "amp",
  "nxt",
  "dash",
  "xdn",
  "nbt",
  "nav",
  "pot",
  "gnt",
  "waves",
  "usdt",
  "swt",
  "mln",
  "pivx",
  "trst",
  "edg",
  "rlc",
  "gno",
  "dcr",
  "gup",
  "lun",
  "str",
  "bat",
  "ant",
  "bnt",
  "cvc",
  "eos",
  "pay",
  "bch",
  "omg",
  "mco",
  "adx",
  "zrx",
  "qtum",
  "ptoy",
  "storj",
  "cfi",
  "hmq",
  "nmr",
  "salt",
  "btg",
  "dgb",
  "dnt",
  "vib",
  "rcn",
  "zcl",
  "stx",
  "kmd",
  "brd",
  "dcn",
  "ngc",
  "xmo",
  "noah",
  "zen"
]

getCurrenciesFull

Description: + Returns a full list of currencies as an array of objects. Each object has an "enabled" field displaying current availability of a coin., (*4)

$changelly->getCurrenciesFull();

result:, (*5)

[
  {
    "name": "btc",
    "fullName": "Bitcoin",
    "enabled": true,
    "image": "https://changelly.com/coins/btc.svg"
  },
  {
    "name": "eth",
    "fullName": "Ethereum",
    "enabled": true,
    "image": "https://changelly.com/coins/eth.svg"
  },
  {
    "name": "etc",
    "fullName": "Ethereum Classic",
    "enabled": true,
    "image": "https://changelly.com/coins/etc.svg"
  },
  (...)
  {
    "name": "zen",
    "fullName": "Zencash",
    "enabled": true,
    "image": "https://changelly.com/coins/zen.svg"
  }
]

getMinAmount

Description: + Returns a minimum allowed payin amount required for a currency pair. Amounts less than a minimal will most likely fail the transaction., (*6)

$changelly->getMinAmount('btc', 'eth');

result:, (*7)

"0.00150457"

getExchangeAmount

Description: + Returns estimated exchange value with your API partner fee included., (*8)

$changelly->getExchangeAmount('btc', 'eth', '1');

result:, (*9)

"12.10716"

createTransaction

Description: + Creates a new transaction, generates a pay-in address and returns Transaction object with an ID field to track a transaction status., (*10)

$changelly->createTransaction('btc', 'eth', '0x123123...123', 0.3);

result:, (*11)

{
  "id": "854e8d7dc9ef",
  "apiExtraFee": "0",
  "changellyFee": "0.5",
  "payinExtraId": null,
  "status": "new",
  "currencyFrom": "btc",
  "currencyTo": "eth",
  "amountTo": 0,
  "payinAddress": "36P9TNYPbZrGs8Udn84F9uAY95VYM2Xk4K",
  "payoutAddress": "0x123123...123",
  "createdAt": "2018-05-04T15:15:02.000Z"
}

getStatus

Description: + Returns status of a given transaction using a transaction ID provided., (*12)

$changelly->getStatus('854e8d7dc9ef');

result:, (*13)

"waiting"

getTransactions

Description: + Returns an array of all transactions or a filtered list of transactions., (*14)

$changelly->getTransactions();

result:, (*15)

[
  {
    "id": "854e8d7dc9ef",
    "createdAt": 1525446902,
    "payinConfirmations": "0",
    "status": "waiting",
    "currencyFrom": "btc",
    "currencyTo": "eth",
    "payinAddress": "36P9TNYPbZrGs8Udn84F9uAY95VYM2Xk4K",
    "payinExtraId": null,
    "payinHash": null,
    "payoutAddress": "0x123123...123",
    "payoutExtraId": null,
    "payoutHash": null,
    "amountFrom": "",
    "amountTo": "0",
    "networkFee": null,
    "changellyFee": "0.5",
    "apiExtraFee": "0"
  },
  (...)
]

The Versions

04/05 2018

dev-master

9999999-dev

A Symfony Bundle for Changelly APIs

  Sources   Download

MIT

The Requires

 

bundle symfony client crypto exchange changelly