PHP code example of fatfingers23 / replit-database-client

1. Go to this page and download the library: Download fatfingers23/replit-database-client 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/ */

    

fatfingers23 / replit-database-client example snippets




atfingers23\ReplitDatabaseClient\DatabaseClient;

$client = new DatabaseClient();
$client->set('key', 'value');
$key = $client->get('key');
echo $key;


$client->set('key', 'value');


$client->set('key', ['greeting' => 'Hello World!']);


$key = $client->get('key');
echo $key;


$key = $client->get('key');
var_dump($key);
echo $key['greeting'];


$client->delete('key');


$client->set('poet.1', 'John Keats');
$client->set('poet.2', 'Emily Dickinson');
$poetKeys = $client->getPrefixKeys('poet');

#var_export($poetKeys) result below
array (
  0 => 'poet.1',
  1 => 'poet.2',
)


$client->set('poet.1', 'John Keats');
$client->set('poet.2', 'Emily Dickinson');
$poets = $client->getPrefix('poet');

#var_export($poets) result below
array (
  'poet.1' => 'John Keats',
  'poet.2' => 'Emily Dickinson',
)


$client->deleteByPrefix('poet');