Skip to content

Entity Models Catalog ​

Tueen Database provides 22+ specialized domain models optimized for Telegram bots.


🏛️ Entity & Table Summary ​

Entity ClassTable NamePurpose
ChatchatsCore Telegram chat, user, group, supergroup, or channel record
ContactcontactsTelegram shared contact cards (phone, first name, last name)
ChatMetachat_metaKey-value settings and metadata per chat
ChatLikechat_likesSocial like relationships between chats
ChatRatingchat_ratingsNumerical ratings (0-100) between chats
ChatXpchat_xpGamification experience points per chat
ChatXpTransactionchat_xp_transactionsImmutable audit log of XP adjustments
WalletBalancewallet_balancesMulti-currency balance ledger (TON, Stars, USDT, fiat)
WalletTransactionwallet_transactionsDouble-entry transaction ledger with audit trail
TreasurytreasuryBot operator's reserve balance and total commission
TreasuryTransactiontreasury_transactionsAudit log of treasury movements
CouponcouponsDiscount voucher codes (percentage and fixed)
CouponMetacoupon_metaKey-value metadata per coupon
CouponUsagecoupon_usagesRedemption tracking per user and order
OrderordersBilling orders, invoice tracking, tax, and delivery
OrderMetaorder_metaKey-value metadata per order
WithdrawalwithdrawalsPayout requests to crypto wallets, cards, or bank accounts
WithdrawalMetawithdrawal_metaKey-value metadata per withdrawal
SubscriptionsubscriptionsTime-limited memberships and VIP privileges
SubscriptionTransactionsubscription_transactionsAudit log of subscription extensions and renewals
ReferralreferralsViral growth and affiliate tracking with self-referral prevention
BroadcastMessagebroadcast_messagesChunked mass messaging campaigns with offset cursor
EntityItementitiesGeneric CMS content catalog (products, tickets, articles)
EntityMetaentity_metaKey-value metadata per content entity
EntityLikeentity_likesSocial likes on content entities
EntityRatingentity_ratingsNumerical ratings on content entities
MessageRelaymessage_relaysCross-chat message bridging and ticketing relays
OptionoptionsGlobal bot settings and configuration store
DataItemdataBinary blob storage and persistent sessions
CacheItemcacheDatabase-backed PSR-16 cache store with TTL
TmaSessiontma_sessionsTelegram Mini App (TMA) authentication and bearer sessions
HistoryhistoriesUniversal polymorphic audit trail for any model action
SchemaVersionschema_versionsApplied schema versions and migration tracking

🪝 PHP 8.4 Property Hooks Reference ​

EntityProperty HookTypeDescription
Chat$isPrivateboolTrue if type is private (1-on-1 user)
Chat$isGroupOrSupergroupboolTrue if type is group or supergroup
Chat$isChannelboolTrue if type is channel
Chat$displayNamestringResolved name, @username, or string chat ID
Chat$canReceiveMessagesboolTrue if accessible and not banned
Chat$username (set hook)?stringAutomatically normalizes and strips leading @
Contact$fullNamestringFormatted Firstname Lastname
Contact$phoneNumber (set hook)stringAutomatically normalizes and strips leading +
WalletBalance$hasPositiveBalanceboolTrue if balance > 0
WalletTransaction$isCreditboolTrue if amount > 0
WalletTransaction$isDebitboolTrue if amount < 0
Coupon$isValidNowboolTrue if active and within start/end dates
Order$isPaidboolTrue if status is Paid or Completed
Order$totalAmountstringComputed subtotal + tax + shipping - discount
Withdrawal$netIncomestringComputed gross amount - fee
Subscription$isActiveboolTrue if expiresAt > now
Subscription$remainingSecondsintRemaining seconds until expiration
BroadcastMessage$progressPercentagefloatComputed delivery percentage (0.0 to 100.0)
BroadcastMessage$isFinishedboolTrue if broadcast is completed, cancelled, or failed
CacheItem$isExpiredboolTrue if expiration time has passed
Referral$isQualifiedboolTrue if referral status is qualified
TmaSession$isExpiredboolTrue if session expiresAt has passed
TmaSession$isValidboolTrue if not revoked and not expired

Released under the MIT License.