survos/key-value-bundle

manage dynamic key value(s) list

Maintainers

👁 tacman1123

Package info

github.com/survos/SurvosKeyValueBundle

Homepage

Type:symfony-bundle

pkg:composer/survos/key-value-bundle

Fund package maintenance!

kbond

Statistics

Installs: 322

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 2

1.6.44 2025-07-26 14:04 UTC

Requires

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 90776c2d25e6d3ef97ef0a2e6aaaddb7e428cb7e

  • Tac Tacelosky <tacman.woop@gmail.com>
  • victor <fedorenko22116.woop@gmail.com>

symfonybundlekey-value

This package is auto-updated.

Last update: 2026-06-12 18:36:01 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 
 }
 }