Declarative Zero-Config
Instant lazy schema synchronization on boot. No manual migrations needed to launch bots or install extensions.
The zero-config, high-throughput database engine engineered for high-concurrency bots on PHP 8.4+ and Doctrine ORM 3.
Initialize your database in seconds with full transactional safety:
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
}