PHP code example of sugarcraft / sugar-skate

1. Go to this page and download the library: Download sugarcraft/sugar-skate 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/ */

    

sugarcraft / sugar-skate example snippets


use SugarCraft\Skate\Store;

$skate = new Store();

// Set and get
$skate->set('greeting', 'Hello, World!');
echo $skate->get('greeting'); // Hello, World!

// With a database
$skate->set('token', 'ghp_xxxx', 'passwords');
echo $skate->get('token', 'passwords');

// List all keys
foreach ($skate->list() as $entry) {
    echo "{$entry->key} => {$entry->value}\n";
}

// Glob patterns
foreach ($skate->list(pattern: 'user-*') as $entry) { ... }

// Delete
$skate->delete('greeting');