1. Go to this page and download the library: Download seba1rx/tabmanager 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/ */
seba1rx / tabmanager example snippets
Seba1rx\TabManager\TabManager;
$tabManager = new TabManager();
// Write tab-specific data
$tabManager->set('user_step', 3);
$tabManager->set('draft_id', 42);
// Read it back (from the same tab only)
$step = $tabManager->get('user_step'); // 3
// heartbeat-tab.php
_TABMANAGER_TABID'] ?? null;
if ($tabId) {
$tm = new Seba1rx\TabManager\TabManager();
$tm->touchTab($tabId);
}
http_response_code(204);
interface SessionStoreInterface
{
public function start(): void; // start if not already active (idempotent)
public function isActive(): bool; // whether the session is currently active
public function get(string $key, mixed $default = null): mixed;
public function set(string $key, mixed $value): void;
public function has(string $key): bool;
public function remove(string $key): void;
}
$tm = new TabManager(); // uses PhpSessionStore → calls session_start() if needed
use Seba1rx\TabManager\Contracts\SessionStoreInterface;
use Seba1rx\TabManager\TabManager;
class MySessionStore implements SessionStoreInterface
{
public function start(): void { /* session already started by your framework */ }
public function isActive(): bool { return /* check your session driver */; }
public function get(string $key, mixed $default = null): mixed { /* ... */ }
public function set(string $key, mixed $value): void { /* ... */ }
public function has(string $key): bool { /* ... */ }
public function remove(string $key): void { /* ... */ }
}
$tm = new TabManager(new MySessionStore());