PHP code example of tony-sol / symfony-consul

1. Go to this page and download the library: Download tony-sol/symfony-consul 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/ */

    

tony-sol / symfony-consul example snippets


public function __construct(
        private \Consul\Engine\KV\KVInterface $consulKVStorage
) {
}

public function set(): void
{
    $key = 'foo';
    $value = 'bar';
    $this->consulKVStorage->set($key, $value);
}

public function get(): void
{
    $key = 'foo';
    $value = $this->consulKVStorage->get($key);
        // $value instanceof ConsulResponseInterface
        // (string)$value = 'bar'
}