overlay/overlay-php
Composer 安装命令:
composer require overlay/overlay-php
包简介
Overlay enables simple Web3 development across multiple blockchains, including Solana, Ethereum, BSC, Base, Polygon, and Bera. It does not require signing transactions with wallets, which is typically necessary in blockchain development.
README 文档
README
A PHP library for Web3 development that makes it easy to implement wallet creation, token and NFT issuance, minting, burning, and transfers across multiple blockchains.
📖 Overview
Overlay enables simple Web3 development across multiple blockchains, including:
- Solana
- Ethereum
- BSC (Binance Smart Chain)
- Base
- Polygon
- Bera Chain
It eliminates the need for signing transactions with wallets, which is typically necessary in blockchain development. Overlay implements high-level security features and securely encrypts wallet information to safely execute transactions without storing any database locally.
🚀 Installation
Via Composer
composer require overlay/overlay-php
⚙️ Configuration
Before using the library, you need to configure your API credentials:
<?php require_once 'vendor/autoload.php'; use Overlay\Client; $client = new Client([ 'api_key' => 'your_api_key', 'auth_key' => 'your_auth_key', 'env' => 'devnet' // or 'mainnet' ]);
🌐 Environment Options
| Environment | URL | Description |
|---|---|---|
devnet |
https://devnet.overlay.fun |
Development environment |
mainnet |
https://mainnet.overlay.fun |
Production environment |
📘 Usage
👛 Wallet
Create a Wallet
// Create a new wallet $response = $client->wallet->create([ 'network' => 'solana' // or 'evm' ]); echo $response;
🪙 Token
Create a Token
// Create a new token $response = $client->token->create([ 'network' => 'solana', // or 'eth', 'base', 'bsc', 'blast', 'polygon', 'bera', 'monad', etc 'name' => 'My Token', 'symbol' => 'MTK', 'image' => 'image url', 'supply' => 1000000000, 'decimals' => 9, // Add other token parameters ]); echo $response;
Mint Tokens
// Mint tokens to an address $mintAddress = 'your_token_mint_address'; $response = $client->token->mint($mintAddress, [ 'network' => 'solana', 'amount' => 1000 ]); echo $response->success;
Transfer Tokens
// Transfer tokens between addresses $response = $client->token->transfer($mintAddress, [ 'network' => 'solana', 'amount' => 1000, 'recipient' => 'recipient_address' ]);
Burn Tokens
// Burn tokens $response = $client->token->burn($mintAddress, [ 'network' => 'solana', 'amount' => 1000 ]);
🖼️ NFT
Create an NFT
// Create a new NFT collection or individual NFT $response = $client->nft->create([ 'network' => 'solana', 'name' => 'My NFT', 'symbol' => 'MNFT', 'description' => 'A unique NFT', 'images' => ['https://example.com/image.png'], // Add other NFT metadata ]); echo $response->success;
Mint NFTs
// Mint an NFT $mintAddress = 'your_nft_mint_address'; $response = $client->nft->mint($mintAddress, [ 'network' => 'solana' ]);
Transfer NFTs
// Transfer an NFT $response = $client->nft->transfer($mintAddress, [ 'network' => 'solana', 'recipient' => 'new_owner' ]);
Burn NFTs
// Burn an NFT $response = $client->nft->burn($mintAddress, [ 'network' => 'solana' ]);
📦 Response Object
All methods return an Overlay\Response object with the following structure:
$response = $client->token->create($params); // Access response properties echo $response->success; // Boolean indicating success/failure echo $response->message; // Response message print_r($response->data); // Response data array // Data properties are also accessible directly echo $response->mint_address ?? 'N/A'; // Direct access to data properties // Convert to array or JSON $array = $response->toArray(); $json = $response->toJson();
⚠️ Error Handling
The library includes built-in error handling. Always check the success property of the response:
$response = $client->token->mint($mintAddress, ['amount' => 1000]); if ($response->success) { echo "✅ Token minted successfully!\n"; echo "Transaction ID: " . $response->transaction_id . "\n"; } else { echo "❌ Error: " . $response->message . "\n"; }
🌍 Supported Blockchains
- 🔥 Solana
- ⚡ Ethereum
- 💛 Binance Smart Chain (BSC)
- 🔵 Base
- 🟣 Polygon
- 🐻 Bera Chain
🔐 Security Features
- ✅ No local database storage
- 🔒 Secure wallet encryption
- 🛡️ High-level security implementation
- 🔑 Safe transaction execution without exposing private keys
📋 Requirements
- PHP >= 8.0
- ext-curl - cURL extension
- ext-json - JSON extension
🛠️ Development
After cloning the repository, run:
composer install
Running Tests
# Run PHPUnit tests (when available) composer test
🤝 Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/overlaydotfun/overlay-php.
📚 Documentation
For more detailed documentation, visit: https://docs.overlay.fun
📄 License
This library is available as open source under the terms of the MIT License.
📞 Contact
- 📧 Email: contact@overlay.fun
- 🌐 Website: https://overlay.fun
- 📖 Documentation: https://docs.overlay.fun
Examples
Complete Example
<?php require_once 'vendor/autoload.php'; use Overlay\Client; // Initialize client $client = new Client([ 'api_key' => 'your_api_key', 'auth_key' => 'your_auth_key', 'env' => 'devnet' ]); try { // Create a wallet $walletResponse = $client->wallet->create(['network' => 'solana']); if ($walletResponse->success) { echo "Wallet created: " . $walletResponse->wallet_address . "\n"; } // Create a token $tokenResponse = $client->token->create([ 'network' => 'solana', 'name' => 'Test Token', 'symbol' => 'TEST', 'supply' => 1000000, 'decimals' => 9 ]); if ($tokenResponse->success) { echo "Token created: " . $tokenResponse->mint_address . "\n"; // Mint some tokens $mintResponse = $client->token->mint($tokenResponse->mint_address, [ 'network' => 'solana', 'amount' => 1000 ]); if ($mintResponse->success) { echo "Tokens minted successfully!\n"; } } } catch (Exception $e) { echo "Error: " . $e->getMessage() . "\n"; }
overlay/overlay-php 适用场景与选型建议
overlay/overlay-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 08 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「token」 「blockchain」 「Polygon」 「ethereum」 「web3」 「solana」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 overlay/overlay-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 overlay/overlay-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 overlay/overlay-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The BlockTrail PHP SDK, for integration of Bitcoin functionality through the BlockTrail API
A package for validating Google Cloud's JWT provided by webhooks
JSON Web Token Authentication for Laravel and Lumen
Solana PHP SDK for interacting with the Solana blockchain
A fast and dynamic Merkle tree implementation
JSON Web Token Authentication for Laravel and Lumen
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 42
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-18