Download the PHP package coinpaymentsnet/coinpayments-php without Composer

On this page you can find all versions of the php package coinpaymentsnet/coinpayments-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

Please rate this library. Is it a good library?

All versions of coinpayments-php with dependencies

Informations about the package coinpayments-php

CoinPayments.net PHP API Wrapper.

Requirements

It's recommended to use a newer version of PHP. This library was written in a PHP v7.2.8-1+ environment. The minimum version we've tested the code against is PHP v 5.5+. Our PHP version compatibility test used a combination of PHP CodeSniffer and PHP Compatability.

A CoinPayments.net account with an API keys pair setup (public & private). For the latest instructions visit our online API documentation to learn how to setup your API Keys and get a link to your account API Keys page.

See the testing section below for additional requirements to test certain commands with LTCT or mainnet coins.

Note this wrapper assumes the format requested for API responses is JSON. The alternative is XML but the XML format is not documented or supported by this wrapper. By default every API call will return JSON unless otherwise specified.

Installation

GitHub

This CoinPayments.net API wrapper can be downloaded directly or cloned with GitHub. To use it in your project either clone this repository or download a ZIP to the directory of your choosing.

The minimum files required for usage are those in the source folder, CoinpaymentsAPI.php, CoinpaymentsValidator.php and CoinpaymentsCurlRequest.php. A 4th required file for usage of predefined API keys and testing variables is keys.php. There is a keys_example.php file which can be populated and renamed to keys.php. This keys file is used to pass your public and private API keys to the wrapper in order to make calls to the Coinpayments.net Platform. You can also manually pass your keys to the CoinpaymentsAPI class if you prefer, instead of using a keys.php file. The keys.php file should be placed in the /src directory.

Composer

To install with composer run the following command

composer require coinpaymentsnet/coinpayments-php

and then include the following line in your project where you want to use the wrapper's classes.

Note the /examples directory does not use composer autoloading.

When using composer to autoload classes you should define your keys.php file outside of your vendor directory, as not to overwrite it when upgrading packages. See src/keys_example.php as an example keys.php file.

Packagist.org package URL

Examples

Previewing the scripts in the /examples directory in your browser is possible once you have setup the public and private keys in the keys.php file. This obviously requires the ability to serve these example PHP files with a web server like Apache. See additional testing notes below for interacting with these examples and your account. Some examples require you to populate initial variables in the example file in order to execute the scripts found within.

Usage

The simplest example is retrieving basic account information.

Testing

A full population of the keys.php file is required in order to run the PHPUnit tests in the test folder and preview the scripts in the /examples directory. The different requirements for testing commands are described below with the commands shown in the format:

With only the public and private keys populated, the following commands can be tested. Balances and deposit addresses require their respective resources to have been deposited (funds), updated (coin acceptance settings) or created (addresses) on your CoinPayments.net account in order for their commands to return non-empty results.

Note that the get_callback_address command and functions above would also need an IPN URL setup in your account or passed with the command should you wish to test your server being notified of payment to the returned address. More information is available here in our documentation for the Instant Payment Notification (IPN) system.

The additional variables (those below the API keys) require setting up a second developer CoinPayments.net account to test the following commands, assuming the currency is LTCT. Alternatively these commands could also be tested with access other addresses or wallets capable of receiving and sending the currency you are testing with, as long as that currency is supported by the CoinPayments.net platform. See supported coins here.

PHPUnit tests

To run the tests from the /tests directory, run this command:

phpunit CoinpaymentsAPITest

with your chosen flags for output type. Alternatively you can configure an IDE, like PHPStorm to run the tests in CoinpaymentsAPITest.php for you. In development of this wrapper we used PHPUnit v7.3.1.

Transaction Fees

Test transactions done with any mainnet coin incur regular transaction and network fees, which is why we highly recommend using LiteCoin Testnet (LTCT) when testing your API integration.

Contributing

If during your work with this wrapper you encounter a bug or have a suggestion to help improve it for others, you are welcome to open a Github issue on this repository and it will be reviewed by one of our development team members. The CoinPayments.net bug bounty does not cover this wrapper.

License

MIT - see LICENSE.md


Version
Requires php Version >=5.5.0

The package coinpaymentsnet/coinpayments-php contains the following files

Loading the files please wait ....