The Vottun PHP SDK provides an easy-to-use PHP interface to interact with the Vottun API, initially designed for operations with ERC20 and ERC721 tokens on the Ethereum blockchain. This SDK simplifies the process of integrating Vottun API functionalities into your PHP applications, including token transfers, querying balances, and managing allowances.
This software is not officially affiliated with Vottun.
- Deploy and mint ERC20 tokens
- Deploy and mint ERC721 NFTs
- Transfer tokens
- Manage allowances
- Query token balances
- Support for big number operations
- Easy to integrate with PHP projects
- PHP >=7.0
- Composer
- A Vottun App ID and API key (https://app.vottun.io/)
βββ examples # Example scripts
βββ lib # Libraries
β βββ Web3 # web3p/web3.php library
β βββ Utils.php # The web3.php Utils class, used to manage big numbers.
βββ src # Source files
βββ VottunClient.php # The main VottunClient class, used to interact with the Vottun API.
βββ ERCv1 # Vottun ERC v1 API clients
βββ ERC20Client.php # The ERC20Client class, used to interact with ERC20 tokens.
βββ ERC721Client.php # The ERC721Client class, used to interact with ERC721 tokens.
Run the following command in your project directory to add the Vottun PHP SDK as a dependency:
composer require ceseshi/vottun-php-sdk
Here's a quick start guide on how to use the Vottun PHP SDK in your project.
require_once 'vendor/autoload.php';
use Vottun\VottunClient;
use Vottun\ERCv1\ERC20Client;
$vottunApiKey = 'your_api_key_here';
$vottunApplicationVkn = 'your_application_vkn_here';
$vottunClient = new VottunClient($vottunApiKey, $vottunApplicationVkn);
$network = 80001; // Mumbai
$erc20token = new ERC20Client($vottunClient, $network, null);
$name = 'MyToken';
$symbol = 'MTK';
$decimals = 18;
$initialSupply = strval(\Web3\Utils::toWei("1000000", 'ether')); // Initial supply in Wei
$transactionHash = $erc20token->deploy($name, $symbol, $decimals, $initialSupply);
$contractAddress = $erc20token->getContractAddress();
echo "Deploy hash: {$transactionHash}";
echo "Deploy address: {$contractAddress}";
$contractAddress = 'your_contract_address_here';
$erc20token = new ERC20Client($vottunClient, $network, $contractAddress);
$recipientAddress = 'recipient_address_here';
$amount = strval(\Web3\Utils::toWei("100.001", 'ether')); // Amount in Wei
$transactionHash = $erc20token->transfer($recipientAddress, $amount);
$balance = $erc20token->balanceOf($recipientAddress);
echo "Transfer hash: {$transactionHash}";
echo "Recipient balance: {$balance}";
$contractAddress = 'your_contract_address_here';
$erc721token = new ERC721Client($vottunClient, $network, $contractAddress);
$recipientAddress = 'recipient_address_here';
$ipfsUri = 'ipfs_uri_here';
$ipfsHash = 'ipfs_hash_here';
$royaltyPercentage = 10;
$tokenId = 1;
$transactionHash = $erc721token->mint($recipientAddress, $tokenId, $ipfsUri, $ipfsHash, $royaltyPercentage);
echo "Mint hash: {$transactionHash}";
- ERC1155 Client
- POAP Client
- Web3 Core Client
- IPFS Client
- Custodied Wallets Client
- Balances Client
- Estimate Gas Client
Contributions to the Vottun PHP SDK are welcome. Please ensure that your contributions adhere to the following guidelines:
- Fork the repository and create your branch from main.
- If you've added code that should be tested, add tests.
- Ensure the test suite passes.
- Issue that pull request!
If you encounter any issues or require assistance, please open an issue on the GitHub repository.
This project is licensed under the LGPL. See the LICENSE file for details.
- Thanks to the Vottun team for providing the API.