Skip to content

Tueen DatabaseRelational Engine for Telegram Bots

The zero-config, high-throughput database engine engineered for high-concurrency bots on PHP 8.4+ and Doctrine ORM 3.

Tueen Database Logo

⚡ Instant Code Example ​

Initialize your database in seconds with full transactional safety:

php
use Tueen\Database\Config\DatabaseConfig;
use Tueen\Database\DatabaseManager;

// 1. Boot engine with Zero-Config SQLite or MySQL
$db = DatabaseManager::create(DatabaseConfig::createSqlite(':memory:'));

// 2. Register or fetch a Telegram user (automatic @ stripping & emoji safety)
$chat = $db->chats()->findOrCreate(
    chatId: 123456789,
    username: '@super_user',
    name: 'Alice 🚀',
);

// 3. Perform an atomic multi-currency credit with audit transaction
$tx = $db->wallets()->credit(
    chat: $chat,
    amount: '100.000000000000000000',
    currency: 'TON',
    source: 'stars_deposit',
);

// 4. Check real-time property hook states
if ($chat->isPrivate && $chat->canReceiveMessages) {
    // Deliver bot message
}

Released under the MIT License.