Download the PHP package jucci1887/erc20-php-api without Composer
On this page you can find all versions of the php package jucci1887/erc20-php-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jucci1887/erc20-php-api
More information about jucci1887/erc20-php-api
Files in jucci1887/erc20-php-api
Package erc20-php-api
Short Description This library provides simple way to interact with Ethereum ERC20 token. Thanks for Lessmore92
License MIT
Informations about the package erc20-php-api
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.
Thanks for lessmore92/php-erc20
Installation
composer require jucci1887/erc20-php-api
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 \Jucci1887\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 erc20-php-api with dependencies
jucci1887/web3-php Version ~1.0
kornrunner/ethereum-offline-raw-tx Version 0.2.4