PHP code example of survos / key-value-bundle

1. Go to this page and download the library: Download survos/key-value-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

survos / key-value-bundle example snippets


    #[Route('/', name: 'app_homepage', methods: [Request::METHOD_GET])]
    public function index(
                          KeyValueManagerInterface $kvManager,
                          ): Response
    {
        if ($kvManager->has($password, 'excluded_password')) {
            // 
        }
    }

    #[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 
            }
        }