Download the PHP package klev-o/crypto-pay-api without Composer

On this page you can find all versions of the php package klev-o/crypto-pay-api. 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 crypto-pay-api

klev-o/crypto-pay-api

Simple and convenient implementation Crypto Pay API with php version ^7.4 support. Based on the Official Crypto Pay Api

License Packagist Downloads GitHub release (latest by date including pre-releases) Scrutinizer code quality (GitHub/Bitbucket) GitHub last commit

📖 Intro

Fully object-oriented and simple code. All available types and methods are described using classes with documentation of all fields. For each class, the url to the documentation is indicated, where you can study the nuances, etc.

🛠 Installation

Run this command in your command line:

🔌Usage

Common

First, you need to create an object of the CryptoPay class, passing the API key of your application to the constructor:

To create an app and get an api token, open @CryptoBot or @CryptoTestnetBot (for testnet), send /pay command, then go to ‘Create App’.

You can pass the second parameter $isTestnet to the CryproPay constructor to make all requests go through the testnet. This is useful for any experiments)

Then you can call all possible methods. To check that everything is working correctly, you can call the $api->getMe() method, which will return basic information about your application.

If everything works well, then you will see something like this

For more complex methods, value objects are used, for example, this is how you can create invoices:

As you can see above, required parameters are passed through the constructor, while optional parameters can be set directly. Also, for values that expect "one of", special enums are created, located at the namespace Klev\CryptoPayApi\Enums.

By the same principle, objects are created for the methods getInvoice() and Transfer()


More detailed examples can be found in the demo directory

All available methods can be viewed at the $api object, or refer to the official documentation

Webhooks

Using a webhook, you can receive updates for your application

Please note that the interceptor must first be activated in your application. This can be done in the following way: open @CryptoBot or @CryptoTestnetBot (for testnet), send /pay command, then go to ‘My Apps’, choose your app, open ‘Webhooks’ and click ‘Enable Webhooks’. Read more here

To receive updates, you need to use the $api->getWebhookUpdates() method and subscribe to listen for the necessary events. There is currently only one event (or update type) available - invoice_paid. It also has an enum - PaidType::INVOICE_PAID:

You can register multiple handlers for the same event.

You can also just get the result from the $api->getWebhookUpdates() method without subscribing to events

By default, events are disabled. To enable them, you need to use the method $api->setEnableEvents(true);

📟Advanced

Also, as an event handler, you can use anything that corresponds to the callable type. Let's take an example:

Let's say we have installed composer require php-di/php-di, although you can use any other psr-compatible

You can use your dependency injection container to pipe all the necessary functionality from your code into handlers

🎁Dontations

Support the project if you like it. Funds will go towards food.

Network Currency Wallet
Bitcoin BTC 1M1qhSE6sN34a4d7ZtCh6y17Vf3LtdoW62
or
14cvXywCMucKMhFYDCbmQ1ZHhayDgbD65R
The Open Network TON EQAYZK8rWrS9Fhojdc486BpplDmTSLHum440f-L2--SA2Oid
or
ton://transfer/UQBVsumSIvsq4PfeFMhxSV9m_zPB31cHJX4X2lAVh9BUJXm3
Binance Smart Chain – BEP20 BNB, BUSD, USDT 0x674B09Ab418bb41C075847bde004bb7F492c2121

🧨Troubleshooting

Please, if you find any errors or not exactly - report this problem page

And finally...

Happy botting 🤖


All versions of crypto-pay-api with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4.0
ext-json Version *
ext-curl Version *
guzzlehttp/guzzle Version ^7.2
psr/http-client Version ^1.0
psr/http-message Version ^2.0
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 klev-o/crypto-pay-api contains the following files

Loading the files please wait ....