Oyta PHP Common - A Comprehensive Public Package for Developers

·

Overview

Oyta PHP Common is a versatile public package designed to streamline common development tasks with clean, static call methods. Built exclusively for PHP 8.0+, this toolkit integrates cryptographic functions, financial utilities, blockchain interactions, and more—all optimized for performance and ease of use.


Features

Core Functionalities

Key Modules

  1. Cryptography: AES encryption/decryption and ECDSA key generation.
  2. Financial Data: Real-time stock data from Sina Finance and forex rate APIs.
  3. Invite Systems: Database-free invite code generation with UID mapping.
  4. Blockchain: Support for Taproot addresses (BTC), ERC-20/TRC-20 token transfers, and transaction history queries.

Installation

composer require oyta/common

Usage Examples

Password Management

$auth = new Common();
$credentials = $auth->setPass('user123');
$isValid = $auth->verPass($credentials['salt'], 'user123');

Currency Formatting

$formatted = $auth->setFotMoney(123456.789, 2);  // Returns "123,456.79"

Blockchain Address Generation

$btcAddress = $auth->getBtcAddress();  // Generates new BTC Taproot address
$ethTransfers = $auth->getEthTokenTransferRecord('0x...');  // Queries ERC-20 transactions

FAQs

Q: How do I enable virtual currency features?

A: Ensure the gmp extension is active in your PHP environment.

Q: Can I use this package for commercial projects?

A: Absolutely! The package is MIT-licensed—modify and distribute freely.

Q: What’s the precision for money formatting?

A: Adjustable via the $decimals parameter (default: 2).

Q: How secure is the AES encryption?

A: Implements industry-standard 256-bit encryption with dynamic IVs.


Best Practices

👉 Explore advanced blockchain integrations for enterprise-grade solutions.


Advanced Implementations

ETH Token Transfer

$txHash = $auth->EthTokenTransfer(
    $privateKey,
    $senderAddress,
    $recipient,
    '1.5',
    '0xdAC...'  // USDT contract
);

Custom Invite Codes

$inviteCode = $auth->setInvite(90210);  // Generates "ABC123"
$uid = $auth->getInvite('ABC123');      // Returns 90210

👉 Need high-volume transaction monitoring? OKX provides robust APIs for real-time tracking.


Compliance & Performance


Contribution Guidelines

While primarily for personal use, community pull requests are welcome via GitHub. Ensure adherence to:


Final Notes

This package consolidates years of development pain points into a single, optimized toolkit. Whether you’re handling microtransactions or building auth systems, Oyta Common delivers reliability without bloat.

🚀 Pro Tip: For low-latency applications, pre-initialize class methods during app bootstrap.