PHP code example of xsuchy09 / visitor

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

    

xsuchy09 / visitor example snippets


$pdo = $PDO = new PDO(sprintf('pgsql:host=%s;port=%d;dbname=%s;user=%s;password=%s', 'localhost', 5432, 'db_name', 'username', 'password'));
$visitor = new Visitor($pdo, 'HashidsKey'); // it needs pdo instance in constructor and key for Hashids (use your own for your security). You can use others optionally params as you need.
$visitor->addVisit(); // set last visit of of visitor if he is identified or just create the new one with first visit