telegram-bot-essentials / settings
Per-bot typed key/value settings for telegram-bot-essentials/essence
Package info
github.com/Telegram-Bot-Essentials/settings
pkg:composer/telegram-bot-essentials/settings
Requires
- php: ^8.3
- laravel/framework: ^12 || ^13
- telegram-bot-essentials/essence: ^0.12
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.18
- orchestra/testbench: ^10.0 || ^11.0
- pestphp/pest: ^3.7 || ^4.0
- pestphp/pest-plugin-laravel: ^3.1 || ^4.0
README
A per-bot, typed key/value settings system for the
telegram-bot-essentials/essence bot
framework. Every other package in the ecosystem — Billing, User Wallet, Affiliates, the
gateways — registers its configurable options through this package instead of inventing its
own storage, and admins get a generated settings menu for free.
Installation
composer require telegram-bot-essentials/settings php artisan migrate
A locale setting is registered out of the box, letting each bot pick its own
admin/reply language independently.
Usage
Declare a setting once, in a service provider's boot():
use TelegramBotEssentials\Settings\DTOs\Setting; use TelegramBotEssentials\Settings\Enums\SettingType; settings()->addSetting(new Setting( key: 'billing.user_wallet.status', label: fn () => __('my-package::settings.wallet_status.label'), type: SettingType::CHECKBOX, default: false, ));
Then read and write it through the settings() helper — always scoped to the current bot:
settings()->get('billing.user_wallet.status'); // falls back to the declared default settings()->set('billing.user_wallet.status', true); // validated against the type before saving
SettingType covers TEXT, NUMBER, CHECKBOX, SENSITIVE (encrypted at rest),
SELECT / ENUM / MULTISELECT, and DIRECTORY (UI grouping). beforeSet / afterSet
hooks and additive Laravel validation rules are available per setting.
Evaluate lazily. Settings are per-bot and
boot()runs once per application, so never resolvesettings()->get(...)directly inboot()to decide whether to register something — wrap the check in aClosurethat runs at request time.
The package also ships a channel_lock setting group that gates every action behind
membership in a Telegram channel.
Documentation
Full documentation, including the Setting DTO reference, locale switching, and the
channel-lock flow, lives on the Telegram Bot Essentials documentation site under
Modules → Settings.
License
MIT.