Download the PHP package cqtop/eth-nano-erc20 without Composer

On this page you can find all versions of the php package cqtop/eth-nano-erc20. 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 eth-nano-erc20

Simple Ethereum ERC20 token php library

This library provides simple way to interact with Ethereum ERC20 token.
By default, supports all ERC20 Standard functions (like balanceOf, transfer, transferFrom, approve, allowance, decimal, name, ...) also can be extends to support other contracts as well.

基于lessmore92/php-erc20库做了些修改

Installation

composer require cqtop/eth-nano-erc20

Usage

There are two ways to use:

1- Make a new class for your token and specified their functions

2- Use general class with all standard functions

See below to find out more

1-Make a new class for your token

Simply create a new class inherits from \Lessmore92\Ethereum\Foundation\StandardERC20Token

in below sample we create a new class for Tether (USDT)

Then for use create new instantiate from your class and

2- Use general class

Connection Timeout

Connection timeout can be set by last parameter of token class

OR

Ethereum RPC Client

For connect to Ethereum blockchain you need an Ethereum node; Infura is a simple and fast solution, however you can launch you Geth node

ERC20 Token transferFrom

ERC20 transaction fee needs to be paid in ETH. In some situation your app needs to pay this fee behalf of user.
Suppose, user A have a key pair (private, public) and all their transaction is limited to usdt. User A needs to send 10 usdt, but he/she haven't ETH to pay transaction fee.
In these cases your app should pay fee behalf of users.
transferFrom is a good solution in these cases.

transferFrom Flow:

1.First, Using approve method to grant permission to a delegator.
2.Then, Using transferFrom method to make transaction behalf of user.

In Action

allowance to check how much transferFrom remain

$remain = $token->allowance($owner_address, $myapp_address);

Notices:
approve method not need to be used on every transaction.
To revoke transferFrom permission call $token->approve($owner_address, $myapp_address, 0) by amount 0.


All versions of eth-nano-erc20 with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
sc0vu/web3.php Version 0.1.4
web3p/ethereum-util Version 0.1.2
kornrunner/ethereum-offline-raw-tx Version 0.2.4
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 cqtop/eth-nano-erc20 contains the following files

Loading the files please wait ....