Download the PHP package ekliptor/cashp without Composer

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

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package cashp

CashP - PHP library for Bitcoin Cash (BCH) and SLP token payments

This is a PHP library to enable BitCoin Cash (BCH) and SLP token payments. You can easily use this with WordPress, Laravel and other PHP frameworks.

Installation

With composer (recommended):

Manual installation:

  1. Download the source code and include cashp.php from the root directory of this library.
  2. Download the source of this PHP QR-code package and extract it to src/phpqrcode

Requirements

Features

Docs

Take a look at code examples.

CashP class

__construct(CashpOptions $options = null)

Create the main API class.

getRate(): ExchangeRate

Return the exchange rate API.

getBlockchain(): AbstractBlockchainApi

Return the Blockchain API to generate addresses, check balances, transactions,...

generateQrCodeForAddress(string $fileLocal, string $address, float $amountBCH, float $amountToken = 0.0, string $tokenID = ""): bool

Generate a QR code for a payment.

returns bool - true on success, false otherwise


createPaymentURI(string $address, float $amountBCH, float $amountToken = 0.0, string $tokenID = ""): string

Return a payment URI (starting with "bitcoincash:" or "simpleledger:" if $amountToken > 0) for the given $address.

returns string


getBadgerButton(array $btnConf, string $address, float $amountBCH, float $amountToken = 0.0, string $tokenID = ""): string

Get the HTML code of a BadgerButton. See https://badger.bitcoin.com/

returns string - The button HTML.


isValidBchAddress(string $bchAddress): bool

Check if a BCH address is valid.

returns bool - True if the address is valid, false otherwise.


isValidSlpAddress(string $slpAddress): bool

Check if a SLP address is valid.

returns bool - True if the address is valid, false otherwise.


getReturnAddress(Transaction $tx): string

Gets the return BCH address (belonging to the sender senders address) defined as the last address in transaction outputs.

returns string - the address


getReturnSlpAddress(Transaction $tx): string

Gets the return SLP address (belonging to the sender senders address) defined as the last address in transaction outputs.

returns string - the address


CashpOptions class

A set of advanced config properties.

ExchangeRate class

An API to get BCH exchanges rates to fiat currencies.

getRate(string $currency = "USD"): float

Get the current exchange rate for BCH.

returns float


BlockchainApi class

The Blockchain API to generate addresses, check balances, transactions,...

static setLogger(callable $loggerFn): void

Set a logger function for errors and debug output. Use this to write to a logfile or database. If no function is provided everything will be printed using 'echo'.

setHttpAgent(AbstractHttpAgent $agent): void

Set a a HTTP implementation for requests (cURL, Wordpress HTTP API,...)

getConfirmationCount(string $transactionID): int

Return the number of confirmation for the given blockchain transaction ID.

returns int - The number of confirmations or -1 if the $transactionID doesn't exist.


createNewAddress(string $xPub, int $addressCount, string $hdPathFormat = '0/%d'): ?BchAddress

Creates a new address from the xPub.

returns BchAddress - the address or null on failure


getTokenInfo(string $tokenID): ?SlpToken

Get general (network-wide) info about a SLP token.

returns SlpToken - The token or null on failure


getAddressBalance(string $address): float

Return the BCH balance of the given address (including unconfirmed transactions).

returns float - The balance or -1 if the address doesn't exist.


getAddressTokenBalance(string $address, string $tokenID): float

Return the token balance of the given SLP address (including unconfirmed transactions).

returns float - The balance or -1 if the address doesn't exist.


getAddressDetails(string $address): ?BchAddress

Return the BCH Address with all its properties such as balance, TXIDs,...

returns BchAddress - the address or null on failure


getSlpAddressDetails(string $address, string $tokenID): ?SlpTokenAddress

Return the SLP token details of a given address include balance, TXIDs,...

returns SlpTokenAddress - The token or null on failure


getTransaction(string $transactionID): ?Transaction

Returns a transaction with all inputs and outputs including SLP data.

returns Transaction - The transaction or null on failure


Testing

To run unit tests type the following command in the project root directory (requires PHPUnit, installed automatically with Composer):

./vendor/bin/phpunit --bootstrap vendor/autoload.php tests

ToDo

Contact

Twitter

WordPress plugin


All versions of cashp with dependencies

PHP Build Version
Package Version
Requires ekliptor/qr-code Version ^1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ekliptor/cashp contains the following files

Loading the files please wait ....