telegram-bot-essentials/settings
Telegram Bot Essentials — Settings
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.
Related Packages
Powerful PHP database abstraction layer (DBAL) with many features for database s...
Laravel Serializable Closure provides an easy and secure way to serialize closur...
Cli error handling for console/command-line PHP applications.
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| v0.0.25 | ^8.3 | ^12 || | MIT | |
| v0.0.24 | ^8.3 | ^12 || | MIT | |
| v0.0.23 | ^8.3 | ^12 || | MIT | |
| v0.0.22 | ^8.3 | ^12 || | MIT | |
| v0.0.21 | ^8.3 | ^12 || | MIT | |
| v0.0.20 | ^8.3 | ^12 || | MIT | |
| v0.0.19 | ^8.3 | ^12 || | MIT | |
| v0.0.18 | ^8.3 | ^12 || | MIT | |
| v0.0.17 | ^8.3 | ^12 || | MIT | |
| v0.0.16 | ^8.2 | ^12 | MIT | |
| v0.0.15 | ^8.2 | ^12 | MIT | |
| v0.0.14 | ^8.2 | ^12 | MIT | |
| v0.0.13 | ^8.2 | ^12 | MIT | |
| v0.0.12 | ^8.2 | ^12 | MIT | |
| v0.0.11 | ^8.2 | ^12 | MIT | |
| v0.0.10 | ^8.2 | ^12 | MIT | |
| v0.0.9 | ^8.2 | ^12 | MIT | |
| v0.0.8 | ^8.2 | ^12 | MIT | |
| v0.0.7 | ^8.2 | ^12 | MIT | |
| v0.0.6 | ^8.2 | ^12 | MIT | |
| v0.0.5 | ^8.2 | ^12 | MIT | |
| v0.0.4 | ^8.2 | ^12 | MIT | |
| v0.0.3 | ^8.2 | ^12 | MIT | |
| 0.0.2 | ^8.2 | ^12 | MIT | |
| 0.0.1 | ^8.2 | ^12 | MIT |