survos / key-value-bundle
manage dynamic key value(s) list
Fund package maintenance!
kbond
Installs: 119
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 2
Type:symfony-bundle
Requires
- php: ^8.1
- symfony/framework-bundle: ^6.4 || ^7.1
- symfony/validator: ^6.4 || ^7.1
Requires (Dev)
- doctrine/doctrine-bundle: *
- doctrine/orm: ^3.0
- phpstan/phpstan: ^2.1
- rector/rector: ^2.0
- symfony/phpunit-bridge: ^6.4 || ^7.1
- symfony/yaml: ^6.4 || ^7.1
- dev-main
- 1.5.526
- 1.5.525
- 1.5.524
- 1.5.523
- 1.5.522
- 1.5.521
- 1.5.520
- 1.5.519
- 1.5.518
- 1.5.517
- 1.5.516
- 1.5.515
- 1.5.514
- 1.5.513
- 1.5.512
- 1.5.511
- 1.5.510
- 1.5.509
- 1.5.508
- 1.5.507
- 1.5.506
- 1.5.505
- 1.5.241
- 1.5.240
- 1.5.239
- 1.5.238
- 1.5.237
- 1.5.236
- 1.5.235
- 1.5.234
- 1.5.233
- 1.5.232
- 1.5.231
- 1.5.230
- 1.5.229
- 1.5.228
- 1.5.227
- 1.5.226
- 1.5.225
- 1.5.224
- 1.5.223
- 1.5.222
- 1.5.221
- 1.5.220
- 1.5.219
- 1.5.218
- 1.5.217
- 1.5.216
- 1.5.215
- 1.5.214
- 1.5.213
- 1.5.212
- 1.5.211
- 1.5.210
- 1.5.209
- 1.5.208
- 1.5.207
- 1.5.206
- 1.5.205
- 1.5.204
- 1.5.203
- 1.5.202
- 1.5.201
- 1.5.200
- 1.5.199
- 1.5.198
- 1.5.197
- 1.5.196
- 1.5.195
- 1.5.194
- 1.5.193
- 1.5.192
- 1.5.191
- 1.5.190
- 1.5.189
- 1.5.188
- 1.5.187
- 1.5.186
- 1.5.185
- 1.5.184
- 1.5.183
- 1.5.182
- 1.5.181
- 1.5.180
- 1.5.179
- 1.5.178
- 1.5.177
- 1.5.176
- 1.5.175
- 1.5.174
- 1.5.173
- 1.5.172
- 1.5.171
- 1.5.170
- 1.5.169
- 1.5.168
- 1.5.167
- 1.5.166
- 1.5.165
- 1.5.164
- 1.5.163
- 1.5.162
- 1.5.161
- 1.5.160
- 1.5.159
- 1.5.158
- 1.5.157
- 1.5.156
- 1.5.155
- 1.5.154
- 1.5.153
- 1.5.152
- 1.5.151
- 1.5.150
- 1.5.149
- 1.5.148
- 1.5.147
- 1.5.146
- 1.5.145
- 1.5.144
- 1.5.143
- 1.5.142
- 1.5.141
- 1.5.140
- 1.5.139
- 1.5.138
- 1.5.137
- 1.5.136
- 1.5.135
- 1.5.134
- 1.5.133
- 1.5.132
- 1.5.131
- 1.5.130
- 1.5.129
- 1.5.128
- 1.5.127
- 1.5.126
- 1.5.125
- 1.5.124
- 1.5.123
This package is auto-updated.
Last update: 2025-02-23 19:34:28 UTC
README
Flexible bundle to handle Key Value(s) list, e.g. a dynamic list of ips and paths to block bad bots.
Highly inspired by lsbproject/blacklist-bundle https://github.com/AntoineLemaire/BlacklistBundle
Installation
composer require survos/key-value-bundle
Update database schema
bin/console doctrine:schema:update --force
Purpose
I found myself needing short, configurable lists in different application -- translation memory, spelling checks and most commonly, looking for paths and path patterns to include/exclude during monitoring.
Usage
Add properties by key, which are repeatable.
bin/console survos:kv:add excluded_password password bin/console survos:kv:add excluded_password admin root 123
Then in code, check
#[Route('/', name: 'app_homepage', methods: [Request::METHOD_GET])] public function index( KeyValueManagerInterface $kvManager, ): Response { if ($kvManager->has($password, 'excluded_password')) { // } }
This was originally design for use with BlockBotBundle
bin/console survos:kv:add bad_bot_path_pattern "wp-admin" bin/console survos:kv:add bad_bot_path_pattern "phpinfo.php" bin/console survos:kv:add bad_bot_path_pattern "\.php^"
#[AsEventListener(RequestEvent::class, priority: 10000)] public function onKernelRequest(RequestEvent $event): void { foreach ($this->kvManager->get('bad_bot_path_pattern') as $pattern) { if (preg_match("$pattern", $path)) { // temporarily block this IP } }